cryptobitezOriginal post
Web Developer
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)
raise HTTPException(status_code= status.HTTP_403_FORBIDDEN , detail='invalid username or password') # Return an appropriate error status code
Summary
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.