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 }
What token are you looking for?
"providerAccessToken": "",
This token is relevant only when you're using OAuth2
What you expect to be inside it
What is your use-case?
so i'm making a simple notes app with next js so i want my users to see only their own notes
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
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.
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
To do that the best way would be to add an attribute named user_id
within it set the user ID
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
Yes
that way i can create team as well
Yes
Correct
okay i get it now
Recommended threads
- self-hosted auth: /v1/account 404 on saf...
Project created in React/Next.js, Appwrite version 1.6.0. Authentication works in all browsers except Safari (ios), where an attempt to connect to {endpoint}/v1...
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...