I have a secondary server where I do some work can i check in that server that the request to that server is sent by a logged in Appwrite user
You could send the user's JWT token to your server
that expires in 15 min should I send a new JWT with each request
users sessions can last long
What is the recommended whay to work around it
What's your stack? Can you provide some more detail on your setup?
yeah I have an endpoint which makes videos and run some long running processes . I want to put it on my server so that I can use a GPU it is a Python Django backend I have everything else integrated in appwrite how can I check that the request to this long running endpoint is snt by appwrite user.
I user Python Django for ruuning the GPU servers on AWS.
Do you use your Django backend for anything else?
No
Is the original request coming from a client side SDK?
yes
In that case, you can just run a quick check from the client side and only send that request if the user is authenticated so the server wouldn't get this request from unauthenticated users. Then to retrieve the user, you can just use the users API on the server and get the user by ID:
users.get('[USER_ID]');
Basically, the auth check happens on the client. So you can take advantage of the long lasting session.
Steven's suggestion of a JWT would also should work. Just generate a JWT on each request and send it to verify auth status. The short lived token shouldn't be an issue.
I would just use the JWT
Generating a new JWT on each request is not a problem right
because checking if the user is authenticated from client and only sending the request I will have to keep my server endpoint unauthenticated which I can't do because using GPU so it can be expensive
How often will you be making these request?
at max 2-3 time/15 min
Just curious if its every couple of seconds or maybe only a few times a day per day
Per user?
yeah
Recommended threads
- Session not found. Please run appwrite l...
I have encounter an issue with appwrite CLI They asking for a login session but in the doc, it’s mention that only setup client with endpoint / api key is enou...
- ACTIVATE DEPLOYMENT PROBLEM...
It's not giving me the option to activate a deployment that says it's ready..
- general_unauthorized_scope
localhost oauth not working. general_unauthorized_scope error showing. { "message": "User (role: guests) missing scopes ([\"account\"])", "code": 401, ...