View Source Lightning.AuthProviders.Common (Lightning v2.10.4)

Provides common functionality for handling OAuth authentication across different providers.

Summary

Functions

Constructs the authorization URL with the given client, state, scopes, and options.

Builds a new OAuth client with the specified configuration, authorization URL, token URL, and options.

Requests an authentication token from the OAuth provider.

Retrieves user information from the OAuth provider.

Fetches the well-known configuration from the OAuth provider.

Fetches the well-known configuration from the OAuth provider and raises an error if not successful.

Refreshes the authentication token using the OAuth provider.

Checks if a token is still valid or must be refreshed. If expires_at is nil, it will return false, forcing a refresh. If the token has already expired or will expire before the default buffer (in the next 5 minutes) we return false, forcing a refresh.

Functions

Link to this function

authorize_url(client, state, scopes, opts \\ [])

View Source

Constructs the authorization URL with the given client, state, scopes, and options.

Link to this function

build_client(provider, wellknown_url, opts \\ [])

View Source

Builds a new OAuth client with the specified configuration, authorization URL, token URL, and options.

Link to this function

get_token(client, params)

View Source

Requests an authentication token from the OAuth provider.

Link to this function

get_userinfo(client, token, wellknown_url)

View Source

Retrieves user information from the OAuth provider.

Link to this function

get_wellknown(wellknown_url)

View Source

Fetches the well-known configuration from the OAuth provider.

Link to this function

get_wellknown!(wellknown_url)

View Source

Fetches the well-known configuration from the OAuth provider and raises an error if not successful.

Link to this function

introspect(result, provider, wellknown_url)

View Source
Link to this function

refresh_token(client, token)

View Source

Refreshes the authentication token using the OAuth provider.

Link to this function

still_fresh(token_body, threshold \\ 5, time_unit \\ :minute)

View Source

Checks if a token is still valid or must be refreshed. If expires_at is nil, it will return false, forcing a refresh. If the token has already expired or will expire before the default buffer (in the next 5 minutes) we return false, forcing a refresh.