Altme's documentation
Altme's documentation

Example 1 with an “authorization code flow” in Python

This a typical integration with a client-server application.
Install with pip install Flask-pyoidc==3.11.0
This verifier parameters for an authorization code flow are :
Let’s see the code.
NB : you may need to setup ngrok to get the callback if you cannot install it on a internet web server.
import flask
from flask import Flask, jsonify
from flask_pyoidc import OIDCAuthentication
from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata
from flask_pyoidc.user_session import UserSession
# Init Flask
app = Flask(__name__)
OIDC_REDIRECT_URI = '', # your application redirect uri. Must be replaced by ngrok route if local to your desktop
SECRET_KEY = "lkjhlkjh" # your application secret code for session, random
Init OpenID Connect client PYOIDC with teh 3 bridge parameters : client_id, client_secret and issuer URL
client_metadata = ClientMetadata(
client_secret= '0b80ec35-1941-11ed-a869-0a1628958560',
post_logout_redirect_uris=['']) # your post logout uri (optional)
provider_config = ProviderConfiguration(issuer='https://talao.co/sandbox/op',
auth = OIDCAuthentication({'default': provider_config}, app)
Verifiable Credential presented by user is transfered through vp_token in OAuth2 userinfo endpoint
def index():
user_session = UserSession(flask.session)
return jsonify(access_token=user_session.access_token,
userinfo=user_session.userinfo) # this is the user credential
# use with ngrok
if __name__ == '__main__':
IP = ""
app.run( host = IP, port=4000, debug =True)9692-0a1628958560
NB : with that lib, you do not have to manage the id_token, user info and the signature check. All metada needed by the lib is available in the openid config : https://talao.co/sandbox/op/.well-known/openid-configuration