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

json.loads(token) decode error because token is JWT, not json #23

Open
ross-nordstrom opened this issue Dec 21, 2021 · 0 comments
Open

Comments

@ross-nordstrom
Copy link

Hi, I'm trying to use your middleware in my Flask API, authenticating with Keycloak, but I'm getting an error on token = json.loads(token). It seems like it's skipping a "decode jwt" step.

Below is my api setup -- am I using this wrong?

import os

# Got a lookup error when trying the `CustomConfig` approach from README
os.environ['FLASK_DEBUG'] = 'True'
os.environ['FLASK_OIDC_PROVIDER_NAME'] = 'keycloak'
os.environ['FLASK_OIDC_CLIENT_ID'] = 'api'
os.environ['FLASK_OIDC_CLIENT_SECRET'] = os.environ['API_CLIENT_SECRET']
os.environ['FLASK_OIDC_CONFIG_URL'] = 'http://keycloak:8080/auth/realms/global/.well-known/openid-configuration'
os.environ['FLASK_OIDC_USER_ID_FIELD'] = 'preferred_username'

from flask import g
from flaskoidc import FlaskOIDC

app = FlaskOIDC(__name__)


@app.route("/hello")
def hello():
    return g.oidc_token_info
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

1 participant