Back

email session jwt token not coming in response

  • 1
  • Web
Neel
17 Aug, 2023, 15:15

when i'm using createEmailSession to create email login session, in response the token data is not coming with it { "$id": "64de39878196e89e0f5c", "$createdAt": "2023-08-17T15:15:19.539+00:00", "userId": "64dceedda788b04b4fd9", "expire": "2024-08-16T15:15:19.530+00:00", "provider": "email", "providerUid": "@gmail.comyemailm", "providerAccessToken": "", "providerAccessTokenExpiry": "", "providerRefreshToken": "", "ip": "172.19.0.1", "osCode": "WIN", "osName": "Windows", "osVersion": "10", "clientType": "browser", "clientCode": "CH", "clientName": "Chrome", "clientVersion": "115.0", "clientEngine": "Blink", "clientEngineVersion": "115.0.0.0", "deviceName": "desktop", "deviceBrand": "", "deviceModel": "", "countryCode": "--", "countryName": "Unknown", "current": true }

TL;DR
The user is having issues with the email session JWT token not coming in the response. They mention creating a notes app with Next.js and wanting users to only see their own notes. The user also mentions using `createEmailSession` to create an email login session, but the token data is not included in the response. There is no solution provided in the support thread.
Binyamin
17 Aug, 2023, 15:17

What token are you looking for?

Neel
17 Aug, 2023, 15:18

"providerAccessToken": "",

Binyamin
17 Aug, 2023, 15:19

This token is relevant only when you're using OAuth2

Binyamin
17 Aug, 2023, 15:19

What you expect to be inside it

Binyamin
17 Aug, 2023, 15:19

What is your use-case?

Neel
17 Aug, 2023, 15:20

so i'm making a simple notes app with next js so i want my users to see only their own notes

Binyamin
17 Aug, 2023, 15:23

For that you should use general Appwrite login logic. After you've ran the createEmailSession function then you can use account.get() to get the user session, it will set the account cookies (or localstorage) and make any preceding requests will add the user automatically

Binyamin
17 Aug, 2023, 15:24

Meaning, after you've run account.get() and then you use the listDocuments for example then only the document that user can see will returned.

Neel
17 Aug, 2023, 15:26

also how can i map user to document like this note is created by this user how can i do that like is there any way to give foregin key thing to map user to that perticular document

Binyamin
17 Aug, 2023, 15:32

To do that the best way would be to add an attribute named user_id within it set the user ID

Neel
17 Aug, 2023, 15:34

i was reading through docs about permissions, we can user permissions so if i create permission at the time of creation of document than i can do this

Binyamin
17 Aug, 2023, 15:34

Yes

Neel
17 Aug, 2023, 15:34

that way i can create team as well

Binyamin
17 Aug, 2023, 15:34

Yes

Binyamin
17 Aug, 2023, 15:34

Correct

Neel
17 Aug, 2023, 15:35

okay i get it now

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