
Appwrite version: 1.6.0 Client version (16.0.2)
Hi, we are having some issues with sessions currently. We would like active users to stay logged in but they are currently getting logged out which is problematic for these users.
I'm currently testing with a session length of 2 minutes. When the user opens the app we extend their session by doing this:
try {
const account = new Account(client);
await account.updateSession('current');
} catch (error) {
const err = error as { code?: number };
if (err.code === 401) {
handleSessionError(err.code);
}
}
This works and I can see within the Appwrite console that the expire time is extended. I've also debugged this by doing:
const session = await account.getSession('current');
and then logging the session.
Still the session gets invalidated based on the original expire time. So the time of which the session was created. When the original expire time is reached I get an error when doing:
const client = getClient(apiEndpoint, projectId);
const account = new Account(client);
try {
await account.get();
} catch (e) {
console.log('baseQuery error getting account', e);
}
In the logs I then see:
LOG baseQuery error getting account [AppwriteException: User (role: guests) missing scope (account)]
The session is created from a secret from our custom backend server.
await account.createSession(configUser.userId, configUser.authSecret);
Note: I've made sure that the client is only created once in memory, it's then reused so we are not creating a new client multiple times.
Any help/insights would be greatly appreciated!
Recommended threads
- Authentication flow using CreateEmailTok...
Hey all, I am using the .NET SDK for Appwrite v1.7.4 and are working on an authentication / login flow. The process: 1. User logs in with mail 2. Backend cal...
- Download hangs when downloading more tha...
Appwrite 1.7.4 Self hosting on Netcup, I have root server with 4 cores, 8Gb RAM I've uploaded 55Mb file to storage (11 chunks). Whenever I try to download it (...
- general_argument_invalid, Param "email" ...
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: AppwriteException: general_argument_invalid, Param "email" is not optional. (400) E/flut...
