Hey , I am using supertokens python-flask sdk .
I have used decorator verify_session to authorise the api .
The test case for those api's requests are failing with 401 unauthorised error .
I am creating token using the below code provided in the docs and adding necessary roles and permissions
from supertokens_python.recipe.jwt.syncio import create_jwt
from supertokens_python.recipe.jwt.interfaces import CreateJwtOkResult
jwtResponse = create_jwt({
"source": "microservice",
# ... extra payload
})
if isinstance(jwtResponse, CreateJwtOkResult):
jwtStr = jwtResponse.jwt
# Send JWT as Authorization header to M2
else:
raise Exception("Unable to create JWT. Should never come here.")
But with this token the api requests are failing with 401
How do I surpass the authorisation while running test cases ?
Tushar
11/14/2023, 10:38 AM
Hey @rp_st can you help her
r
rp_st
11/14/2023, 12:12 PM
hey @Tushar the verify_sesion function is meant for session tokens verification. Not m2m tokens
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).