
Hello,
I am using the Python SDK. Here is my code for an authenticated route:
TypeScript
account = Account(sessionClient.set_session(session.get('session')))
user = account.get()
However, here is the error printed in my terminal:
TypeScript
1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://192.168.0.218:9443/v1/account
During handling of the above exception, another exception occurred:
AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json())
appwrite.exception.AppwriteException: User (role: guests) missing scope (account)
(Of course I have cut down a lot of the error message, but these are the only important parts.
Thank you!
TL;DR
Issue: Error 401 Client Error: Unauthorized when trying to access a User Account with Python SDK.
Solution: The error message indicates that the user role does not have the necessary scope to access the account. Check and adjust the user's role permissions to include the 'account' scope to resolve the issue.
Please feel to ping me 🙂
Recommended threads
- Error getting session: AppwriteException...
I get this error `Error getting session: AppwriteException: User (role: guests) missing scope (account)` when running in prod. As soon as I try running my app o...
- OTP Session template not working and is ...
Okay so it has been a long while with the issue with OTP Session template, and currently I tried self-hosting and found out that it is linked with Verification ...
- CORS and 401 Unauthorized Issues on Appw...
I'm developing a frontend app using the Appwrite Web SDK on http://localhost:3000, and I'm encountering two issues when trying to register or log in users: COR...
