-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
When creating a file with the following code using a JWT
# Token info
token_data = jwt.decode(token, server.SECRET_KEY, algorithms=server.ALGORITHM)
print(f'JWT: {token}')
print(f'JWT: {token_data}')
# Client
client = Client().set_endpoint(ENDPOINT).set_project(PROJECT).set_jwt(token)
# Making sure token is ok
account = Account(client)
print(account.get())
# Creating a new file
storage = Storage(client)
res = storage.create_file(open('image.png', 'rb'))
The following error is thrown
[Error] Method: POST
[Error] URL: /v1/storage/files
[Error] Type: Appwrite\Database\Exception\Authorization
[Error] Message: Missing "write" permission for role "user:60bf4dfc2c7f4". Only this scopes "["*"]" are given and only this are allowed "["user:60bf4dfc2c7f4"]".
[Error] File: /usr/src/code/src/Appwrite/Database/Database.php
[Error] Line: 235
Output
JWT: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiI2MGJmNGRmYzJjN2Y0Iiwic2Vzc2lvbklkIjoiNjBjOGFkMmI5ZDU3ZSIsImV4cCI6MTYyMzc2NzIyNH0.r0QtMtGMs6P4CWxasR0tHQ0xdJaUA1hSnqzg9AMlnCk
JWT: {'userId': '60bf4dfc2c7f4', 'sessionId': '60c8ad2b9d57e', 'exp': 1623767224}
{'$id': '60bf4dfc2c7f4', 'name': 'Javier', 'registration': 1623150076, 'status': 0, 'passwordUpdate': 1623150076, 'email': 'test@gmail.com', 'emailVerification': True, 'prefs': {}}
Same error when permissions are given.
res = storage.create_file(open('image.png', 'rb'), ['user:60bf4dfc2c7f4'], ['user:60bf4dfc2c7f4'])
Environment:
- Appwrite 0.8
- Python 3.8
- Appwrite Python SDK 0.3
Metadata
Metadata
Assignees
Labels
No labels