Back

[SOLVED] Why only 15 min validity.

  • 0
  • Self Hosted
  • Accounts
  • GraphQL
  • Web
Drake
22 Oct, 2023, 19:02

Im not sure how that will solve your problem....but you can look at the rest api docs or something to see what the API call is to generate a JWT...

TL;DR
The user was initially facing a problem with a session's 15-minute validity. However, the issue was resolved by correctly passing the session in the GraphQL query request. The solution was to use the client-sdk on the server-side (GraphQL) and create the session via REST. The user was also guided to check the documentation for the appwrite-ssr npm package. Additionally, they were advised to refer to a page about authentication that explains how to obtain a cookie or a fallback header. Finally, the user was reminded that using a JWT token is not the primary way Appwrite handles sessions.
Drake
22 Oct, 2023, 19:03

You're very hung up on using a JWT token, but that's not the primary way Appwrite handles sessions...

Drake
22 Oct, 2023, 19:06

In Appwrite the JWT token is used to let a user (who already has a session) grant something else access to make requests on behalf of the user for a short period of time

debashish
22 Oct, 2023, 19:06

I am just trying to avoid the usage of web SDK. and acheive it through graphql query.

Drake
22 Oct, 2023, 19:07

That's fine...it's all the same API

debashish
22 Oct, 2023, 19:09

how when I create a session using createEmailSession query. i get the session. but when I try to get the account details i get this error "(role: applications) missing scope (account)."

Drake
22 Oct, 2023, 19:10

What are you using to make the API call? Apollo or something?

debashish
22 Oct, 2023, 19:11

I am using RTK query on frontend.. and graphql-request on server.

debashish
22 Oct, 2023, 19:11

basically i send the query to server and server makes the call the appwrite

debashish
22 Oct, 2023, 19:12

and whtever response i receive back on server. i send it back to client. reason being i am trying hide the base url of appwrite on frontend.. for security reasons.

debashish
22 Oct, 2023, 19:13

i am also using nextjs auth. for session

Drake
22 Oct, 2023, 19:13

So the response from Appwrite should include some headers and cookies. Are those being used for the subsequent request?

debashish
22 Oct, 2023, 19:14
debashish
22 Oct, 2023, 19:15

this above code is in server.. the response i get is the appwrite session object

debashish
22 Oct, 2023, 19:15

line 42 in the screenshot

Drake
22 Oct, 2023, 19:15

That's just metadata about the session object. It is not the actual session

Drake
22 Oct, 2023, 19:15

The session is in the cookie or fallback header

debashish
22 Oct, 2023, 19:18

okay.. how can i can get the cookie. because above code is the first step to login.

Drake
22 Oct, 2023, 19:20

I don't know the library you're using

Drake
22 Oct, 2023, 19:21

There should be a cookie and/or a fallback header. Read through this page: https://appwrite.io/docs/apis/rest#authentication

I know it says rest but it's all the same

debashish
22 Oct, 2023, 19:22

sure.. I am just using NEXT js, RTK query to make graphl query. not using anything. else . If there is any exisiting project which you have link. which is used without the web sdk.. that would be great too.

debashish
22 Oct, 2023, 19:23

yeah.. will go through this doc. thanks.. for the guidance.

otik
22 Oct, 2023, 20:37

I was facing the same problem and i decided to use client-sdk on server-side (Graphql). You only have to create session via REST. Or you can use appwrite-ssr npm pck

debashish
25 Oct, 2023, 14:08

its fixed now. I am able to make graphql query request passing the session correctly .. the catch is u receive the session as part of the response headers.

Drake
25 Oct, 2023, 14:11

[SOLVED] Why only 15 min validity.

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