Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWVerifier works great on my machine,but fails when runs in docker-container #41

Open
artsyanka opened this issue Jul 1, 2022 · 1 comment

Comments

@artsyanka
Copy link

artsyanka commented Jul 1, 2022

I am writing a flask-api where token-verification is done via okta-jwt-verifier.
I have this code to verify tokens:

import asyncio
from okta_jwt_verifier import AccessTokenVerifier, JWTVerifier

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

def is_access_token_valid(token, issuer,client_id):

jwt_verifier = JWTVerifier(issuer=issuer, client_id=client_id, audience='api://default', leeway=60)
try:
    verified_token = jwt_verifier.verify_access_token(token)
    parsed=jwt_verifier.parse_token(token)
    g.decoded_token=parsed
    loop.run_until_complete(verified_token)
    return True
except Exception:
    print("Exception")
    return False  

It works great when i run this on my machine, but when I do this in docker-container (i have docker-compose.yml file with 2 services: flask and db(PostgreSQL)), the process fails at loop.run_until_complete(verified_token). I am not sure how to work around that issue. Please help if you have any ideas! Thanks in advance!

@sagar-raythatha
Copy link

I am also facing the same issue, were you able to resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants