auth0_provider

Classes

Auth0Provider

Module Contents

class auth0_provider.Auth0Provider(app, oauth: authlib.integrations.flask_client.OAuth, client_id: str, client_secret: str, domain: str)[source]

Bases: mdvtools.auth.auth_provider.AuthProvider

_initialize_oauth()[source]

Registers the Auth0 OAuth provider and validates OpenID Connect metadata.

login() str[source]

Initiates the login process by redirecting to Auth0’s authorization page.

logout() None[source]

Logs the user out by clearing the session and redirecting to Auth0’s logout endpoint.

get_user(token: dict) dict | None[source]

Retrieves the user information using the provided token.

Parameters:

token – Dictionary containing access token and user details

Returns:

User information dictionary or None

get_token() str | None[source]

Retrieves the token from the session.

Returns:

Token string or None

handle_callback() str | None[source]

Handles the Auth0 callback and retrieves the access token.

Returns:

Access token string

is_authenticated(token: str) bool[source]

Checks if the user is authenticated by verifying the token.

Parameters:

token – Access token

Returns:

True if authenticated, False otherwise

is_token_valid(token)[source]

Validates the provided token by verifying its signature using Auth0’s public keys and ensuring it’s not expired.