oidc Module

Classes

Client

OpenID Connect is a layer on top of the OAuth2.

See its specs at https://openid.net/connect/

Prompt

This class defines the constant strings for prompt parameter.

The values are based on https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest

Functions

base64decode

Decode a part of the JWT.

JWT is encoded by padding-less base64url, based on JWS specs.

base64decode(raw, encoding='utf-8')

Parameters

encoding
Required

If you are going to decode the first 2 parts of a JWT, i.e. the header or the payload, the default value "utf-8" would work fine. If you are going to decode the last part i.e. the signature part, it is a binary string so you should use None as encoding here.

encoding
default value: utf-8

decode_id_token

Decodes and validates an id_token and returns its claims as a dictionary.

ID token claims would at least contain: "iss", "sub", "aud", "exp", "iat", per specs and it may contain other optional content such as "preferred_username", maybe more

decode_id_token(id_token, client_id=None, issuer=None, nonce=None, now=None)

Parameters

id_token
client_id
default value: None
issuer
default value: None
nonce
default value: None
now
default value: None

decode_part

Decode a part of the JWT.

JWT is encoded by padding-less base64url, based on JWS specs.

decode_part(raw, encoding='utf-8')

Parameters

encoding
Required

If you are going to decode the first 2 parts of a JWT, i.e. the header or the payload, the default value "utf-8" would work fine. If you are going to decode the last part i.e. the signature part, it is a binary string so you should use None as encoding here.

encoding
default value: utf-8