Skip to main content
atoti.OidcConfig(
    *,
    provider_id: str,
    issuer_url: str,
    client_id: str,
    client_secret: str,
    use_client_secret_as_certificate: bool = False,
    name_claim: str = 'sub',
    roles_claims: Set[str | tuple[str, …]] = frozenset({}),
    scopes: Set[str] = frozenset({}),
    access_token_format: Literal[‘jwt’, ‘opaque’] = 'jwt',
)
The config to delegate authentication to an OpenID Connect provider (Auth0, Google, Keycloak, etc.). The user’s roles are defined using atoti.security.Security.oidc and individual_roles.

Attributes

provider_id

The name of the provider. It is used to build the redirect URL: f"{session_url}/login/oauth2/code/{provider_id}".

issuer_url

str

client_id

str

client_secret

str

use_client_secret_as_certificate

If True, the passed client_secret must be a client certificate. This client certificate will be passed in the X-Cert header of the HTTP request made to the OIDC provider to retrieve an access token.

name_claim

The name of the claim in the ID token (or userinfo) to use as the name of the user.

roles_claims

The claims of the ID token from which to extract roles to use as keys in the role_mapping. When an element of the set is a tuple, the tuple elements will be interpreted as the parts of a path leading to a nested value in the token.

scopes

The scopes to request from the authentication provider. The "openid" scope is required as per the OIDC specification.

access_token_format

The format of the access tokens delivered by the OIDC provider. Opaque tokens involve another request to the OIDC provider’s user info endpoint to retrieve the user details. The URL of this user info endpoint will be fetched from the f"{issuer_url}/.well-known/openid-configuration" endpoint.
See also: Opaque tokens can be used with atoti.OAuth2ResourceOwnerPasswordAuthentication.