puiterwijk / flask-oidc

OpenID Connect support for Flask
BSD 2-Clause "Simplified" License
156 stars 218 forks source link

access_token and resource_server #50

Closed ashic closed 5 years ago

ashic commented 6 years ago

For access_token based API calls, there's no way if getting any information, as get_access_token uses the sub of the id_token. If a user's not logged in (e.g. API call with Bearer token), then it blows up. Looking up the access token from the header, and passing it to oidc._get_token_info(token) does introspect and give the token details though. Is there something wrong with this approach?

puiterwijk commented 5 years ago

Hi,

Thanks for your interest in flask-oidc. For the resource server case, flask.g.oidc_token_info gets set with the output of _get_token_info, so all the token claims, if the token is indeed valid and contains the required scopes. This is referenced in the documentation: return json.dumps('Welcome %s' % g.oidc_token_info['sub']).