
Need help. I am trying to create JWT token on rest api (Client) with post request but I am getting this response {"message":"User(role:guests) missing scope (account)","code":401,"type":"general_unauthorized_scope"......... . I have created email session but still getting this response.

"User(role:guests) missing scope" when creating JWT

role:guests indicates you don't have a valid session. You need to log in first

Noted, but Sir I have created an email session using rest API and after I got user credentials then I posted a JWT request.

Sure, but the session you created wasn't used when making the create JWT API call

Can you tell me more about your tech stack?

Docker

I meant for your front end app

Sir, I am making call from Android using client rest API. Wanted to use Android sdks but they are in aar instead of Jar, and App inventor only allow Jar files. So, using rest API.

I see. So you may have to manually manage the session by making sure the cookie is used in the subsequent requests. See https://appwrite.io/docs/rest#client-auth

Is there a way, I pass user id or session I'd from user credentials in rest request for JWT to make JWT request.

I am able to create user successfully and then able to log them in using rest. Also able to get all documents with rules(any) but when I try to change rules to only logged in, not getting any data despite I have logged in user in previous request. So thought that my might pass user JWT to get data. That's the reason of creating a JWT for me.

Did you read what I linked?

Sir, I created session the response I am getting is below (example response) but their is no cookie in response. { "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "userId": "5e5bb8c16897e", "expire": "2020-10-15T06:38:00.000+00:00", "provider": "email", "providerUid": "user@example.com", "providerAccessToken": "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", "providerAccessTokenExpiry": "2020-10-15T06:38:00.000+00:00", "providerRefreshToken": "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", "ip": "127.0.0.1", "osCode": "Mac", "osName": "Mac", "osVersion": "Mac", "clientType": "browser", "clientCode": "CM", "clientName": "Chrome Mobile iOS", "clientVersion": "84.0", "clientEngine": "WebKit", "clientEngineVersion": "605.1.15", "deviceName": "smartphone", "deviceBrand": "Google", "deviceModel": "Nexus 5", "countryCode": "US", "countryName": "United States", "current": true }

Cookies are always sent in the header

So, When I create a session using email, I will get body response in above format and I also get cookie in header of response.

Will try, thaks
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Organization not exists anymore
Hello! We have a problem with a cloud database. We are on the Free plan, but after a refresh the site wants me to create a new organisation, and I not see the c...
- JSON and Object Support in Collection do...
I am working with Next.Js and Appwrite Cloud, I am relatively New to Appwrite but i have noticed there is no direct support of JSON and Object support in attrib...
