Back

Delete Session is not working

  • 0
  • Web
Drake
26 Mar, 2023, 18:44

Same reason why account.get() would fail. There needs to be a session

TL;DR
The user is experiencing issues with deleting a session. They are creating the session on the client side using AstroJS. They are using SSR with AstroJS on a NodeJS server. There seems to be a bug as other support tickets have raised the same error. The error message indicates that the user is missing the scope 'account'. The solution may be to ensure that a session is present and that the user has the necessary permissions.
tdnshah
26 Mar, 2023, 18:44

user CreateEmailSession() I was able to create a session id

tdnshah
26 Mar, 2023, 18:45

I have stored this session id and stored it in browser session storage

tdnshah
26 Mar, 2023, 18:46

now when I need to logout I am just trying to delete the session so that I am logged out, i am following correctly

tdnshah
26 Mar, 2023, 18:47

Still didnt understood

tdnshah
26 Mar, 2023, 18:48

I thought, create account, then create email session is enough to login and authenticate, can you point me to any documentation explaining how this works

Drake
26 Mar, 2023, 20:00

The session isn't just an ID. Is your tech stack?

tdnshah
26 Mar, 2023, 20:01

Sorry didnt get you

Drake
26 Mar, 2023, 20:01

What are you using to build your app? React? NextJS? Nodejs?

tdnshah
26 Mar, 2023, 20:01

Ahh, Astro js

tdnshah
26 Mar, 2023, 20:02

checking what you mentioned in an earlier message if I am getting same error when I am trying to access account.get()

tdnshah
26 Mar, 2023, 20:04

Yeah I get the same error as below on access account.get()

tdnshah
26 Mar, 2023, 20:04
TypeScript
    at Client.<anonymous> (file:///Users/tejas.shah/Projects/thehigglers/thehigglers/node_modules/appwrite/dist/esm/sdk.js:385:27)
    at Generator.next (<anonymous>)
    at fulfilled (file:///Users/tejas.shah/Projects/thehigglers/thehigglers/node_modules/appwrite/dist/esm/sdk.js:22:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 401,
  type: 'general_unauthorized_scope',
  response: {
    message: 'User (role: guests) missing scope (account)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: '0.10.10'
  }
}```
tdnshah
26 Mar, 2023, 20:04

I am using SSR with Astrojs on a node js server

Drake
26 Mar, 2023, 20:33

Ya that's the big problem. You might be creating the session server side which doesn't persist. If you're making the session client side, it won't automatically be used server side

tdnshah
26 Mar, 2023, 20:34

No, No I am not creating the session server side, I am creating it on the client side

Drake
26 Mar, 2023, 20:35

I always recommend avoiding SSR when possible

tdnshah
26 Mar, 2023, 20:35

Astro is little different interms of SSR

tdnshah
26 Mar, 2023, 20:37

I agree over the last office hours this was discussed but with astro we will have to use SSR if authentication needs to be setup, secondly I tried creating the session on client side using vanila js as well, I store the response in session storage still I am unable to delete the created session on the Appwrite.

tdnshah
26 Mar, 2023, 20:38

This seems to be some bug as I saw some other support tickets getting raised with the same error message.

Drake
26 Mar, 2023, 20:38

As I mentioned the result of the API call is just data. It's not the actual session. The session is stored in a cookie or the x-fallback-cookies header

tdnshah
26 Mar, 2023, 20:38

but not 100% sure on this .

Drake
26 Mar, 2023, 20:39
tdnshah
26 Mar, 2023, 20:39

oh is it, and this values gets stored in the cookie by the client sdk itself ?

Drake
26 Mar, 2023, 20:40

Browser automatically handles cookies

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more