Back

anyone done authentication with JWT? my jwt isnt working

  • 0
  • Auth
cryptobitez
12 Apr, 2024, 19:56

When I run the api endpoint below i get an error: [1] User (role: guests) missing scope (account). I'm just trying to implenet auth with JWT. im a hobbyist self taught programmer. I feel like this should be quite simple going from the documentation but it's not working.

@app.post("/api/login", status_code=status.HTTP_200_OK) async def login( credentials : logincred ): try: email, password = credentials.email, credentials.password response = account.create_email_password_session(email, password) token= client.set_jwt() print(response) print(token)

return {'response': response }

except Exception as e:
print(e)

TypeScript
 raise HTTPException(status_code= status.HTTP_403_FORBIDDEN , detail='invalid username or password')  # Return an appropriate error status code
TL;DR
Developers having issues with JWT authentication in their API endpoint. They are encountering an error involving missing scope. The code provided sets JWT token but doesn't address the missing scope issue. Need to adjust permissions or scopes for the JWT token in the authentication process to resolve the error.
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