
Only one more question. When i have session and i send it to server, is there any way to use that session to authorizate the user? Not by creating JWT.

Yes, for that you'll need to do all the login process with a cookie jar. Check this example for a demo.

Btw

What is your use case?

I am sorry for missunderstanding. But this still works by creating JWT on server-side

You're correct in that example you can see 2 things
- The cookie jar
- The JWT which you can ignore

i log in by email on server-side then session saves in cookies on client. Then client sends cookies in headers to server (i am using SSR-sveltekit) and then server should authorizate the user

Okay, that should work

Something like this?

yes exactly, then server sends fallback cookie to user and user back to server during fetch

Good So store that cookie some whare and you can reuse it to auth the user in subsequent requests

And you won't need the JWT

yes but how will i be able to act like user on server-side without JWT (only with session) ? You were creating JWT in your example

Yes, but that is only because in that example he wanted to have JWT. It's like this π When you want to access Appwrite resources as a user you'll need to be authenticate, you can do it in one of two ways
- JWT, which you need to regenerate every 15 minutes
- Cookie, which you need to regenerate after the session timeout has passed which is very long.
As you're already doing by adding the
X-Fallback-Cookies
header like you can see here, you're actually being authenticate as the user. meaning, you can do any REST action on behalf of that user.

Is this make sense?

Yes i am sorry. But can i set cookies on your appwrite SDK?

Thank you very much. This is what i am doing for REST API

What you mean? using the Web SDK?

no no server node.js SDK

Nope, The server SDK supports only the Server side endpoints, so you'll have to use the either the client-side Web sdk or the pure REST like you're already doing.

Also, Check the <:svelte:877959666238386257> Almost-ssr by Meldiron which uses the SDK to login from the server side.

Yes, thank you very much. Maybe i will be looking for another sollutions

Yes thank you, i know i used it

Thank you very much for all your help <:appwriteheart2:1073243188954935387>

<a:agooglethumbsup:635256484682530825>
Recommended threads
- Email Verification Email
Hi everyone, Iβm currently experiencing an issue with the email verification functionality. When I trigger the verification, the request returns a valid respon...
- Appwrite Cloud Custom Domains Issue
Iβm trying to configure my custom domain api.kondri.lt (CNAME pointing to appwrite.network., also tried fra.cloud.appwrite.io with no luck ) but encountering a ...
- Persistent 401 Unauthorized on all authe...
Hello, I'm facing a critical 401 Unauthorized error on my admin panel app and have exhausted all debugging options. The Problem: When my React app on localhos...
