Async All the Way
Changes
I am probably using this wrong and need guidance.
I want to use auth0-python asynchronously. My set up is close to this tutorial. I noticed it depends on PyJWT and I realized the library blocks. I have made an accompanying PR (that this PR points to) but I doubt I'm the first one to use this - I'm probably just using it wrong.
Main change in usage would be (using the tutorial example as my sample):
try:
signing_key = self.jwks_client.get_signing_key_from_jwt( # 👈 this lines changes
token.credentials
).key
except jwt.exceptions.PyJWKClientError as error:
raise UnauthorizedException(str(error))
except jwt.exceptions.DecodeError as error:
raise UnauthorizedException(str(error))
becomes
try:
payload = await self.jwks_client.get_signing_key_from_jwt( # 👈 this lines changes
token.credentials
)
signing_key = payload.key
except jwt.exceptions.PyJWKClientError as error:
raise UnauthorizedException(str(error))
except jwt.exceptions.DecodeError as error:
raise UnauthorizedException(str(error))
References
... None
Testing
Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.
- [ not yet ] This change adds unit test coverage
- [ not yet ] This change adds integration test coverage
- [ partially ] This change has been tested on the latest version of the platform/language or why not no test coverage added because I suspect I'm doing this wrong anyways
Checklist
- [ not yet] I have read the Auth0 general contribution guidelines
- [ I think ] I have read the Auth0 Code of Conduct
- [ I believe ] All existing and new tests complete without errors
Any guidance that @evansims @jpadilla @adamjmcgrath could lend would be much appreciated