Hi, is there any way to get users session token from server by JWT?
It sounds like you're asking for something like impersonation. That's not available yet. The user would have to pass something to the server.
Can you give some additional context on your use case?
yes user would give JWT token to server and server would get session token from appwrite
The JWT token is already the session ...so server wouldn't have to get any other token 🧐
yes, but i would like to get session token because i want to store it into cookies on client-side.........for later access........... i am using sveltekit SSR and i can use only cookies for authentication
The best thing to do might be to
- Set up Appwrite endpoint to be a sub domain of your app
- send the email and password to the server
- Manually log in server side
- Grab the cookie from the response header
- Set the cookie for your client side
This way the cookie will be in your server and client.
Here's an example of this setup: https://svelte-kit.ssr.almostapps.eu/
yes that is what i do. But this way i cant use OAuth2 authentication. And will not be there any problem with rate limit for creating session from server, i mean when all sessions will be created on server-side.
for example, now i cant log in because of rate limit (the error is on server-side)
For oauth2, redirect back to your server at the path /auth/oauth2/success. There should be a secret in the URL that is the cookie value.
You should be fine on rate limit because the rate limit key includes the email
Wow, ok, thank you very much... going to try it
No here (/auth/oauth2/success) is no secret in URL. For OAuth2 i am using your client lib on client is it ok or i have to use rest api?
What's your code? What's in the URL when you hit that page?
Yes, using our SDK should be fine
this is my code
I hope i understand but in url is only http://localhost:5222/oauth2/success nothing else
You're missing auth
I am very sorry, i thought that it was only an example. Yes now i can see it. Thank youu soooo much.
Please is for email session something similar?
No
[SOLVED] The way to get users session token
Recommended threads
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- Migration from Cloud to Self-Hosted not ...
Hello Appwrite Community, I've got the problem, that when I try to migrate my Appwrite Project from the cloud to my self-hosted Appwrite, that an API Key is mi...
- I can't migrate my project from Appwrite...
I'm having an issue migrating my Appwrite project to a self-hosted instance. The problem is that I've exceeded my read rate limit (or database read limit), so I...