Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Session from JWT token #18

Open
asnimansari opened this issue Jan 25, 2025 · 2 comments
Open

Create Session from JWT token #18

asnimansari opened this issue Jan 25, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@asnimansari
Copy link

If I have a JWT token that was created using, for example, the SupabaseJS library, is it possible to create a session with that JWT token so that my Next.js frontend can directly use authenticated APIs in Rust?

@asnimansari asnimansari added the enhancement New feature or request label Jan 25, 2025
@Proziam
Copy link
Collaborator

Proziam commented Jan 26, 2025

The closest thing that comes to mind would be if you have a session from the JS library you could use the refresh token generate a new Session on the rust side like so:

    let new_session = auth_client
        .refresh_session(&refresh_token)
        .await
        .unwrap();

@asnimansari
Copy link
Author

asnimansari commented Feb 4, 2025

I read the JWT cookie from frontend and used it for authentication using

let user = auth_client
        .get_user(&access_token)
        .await

The issue here is after a while I get, JWT token expired message.
Let me try your approach

@Proziam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants