ExLogto.Core (ex_logto v0.1.3)
- Module for generating sign-in URIs.
- Module for handling the verification and parsing of the code from the callback URI.
- This module provides functions to fetch access tokens using the authorization code flow and refresh token flow.
Summary
Functions
Fetches an access token using the authorization code flow.
Fetches an access token using the refresh token flow.
Generates a sign-in URI based on the provided options.
generate a uri for signing out
Verifies and parses the code from the callback URI.
Functions
Link to this function
fetch_token_by_authorization_code(options)
Fetches an access token using the authorization code flow.
Options
:token_endpoint
- The token endpoint URL.:code
- The authorization code.:code_verifier
- The code verifier.:client_id
- The client ID.:client_secret
- The client secret.:redirect_uri
- The redirect URI.:resource
- The resource (optional).
Returns a %{access_token: ..., refresh_token: ..., ...}
map on success, or an error tuple.
Link to this function
fetch_token_by_refresh_token(options)
Fetches an access token using the refresh token flow.
Options
:token_endpoint
- The token endpoint URL.:client_id
- The client ID.:client_secret
- The client secret.:refresh_token
- The refresh token.:resource
- The resource (optional).:scopes
- A list of scopes (optional).:organization_id
- The organization ID (optional).
Returns a %{access_token: ..., refresh_token: ..., ...}
map on success, or an error tuple.
Link to this function
fetch_user_info(access_token)
Link to this function
generate_sign_in_uri(map)
Generates a sign-in URI based on the provided options.
Parameters
options
: aSignInUriGenerationOptions
struct containing the necessary options for generating the sign-in URI.
Returns
{:ok, uri}
: the generated sign-in URI.{:error, reason}
: an error tuple with the reason for the failure.
Link to this function
generate_sign_out_uri(options)
generate a uri for signing out
Link to this function
get_code_from_callback_uri(callback_uri)
Verifies and parses the code from the callback URI.
Args:
- callback_uri (String.t): The callback URI.
- redirect_uri (String.t): The redirect URI.
- state (String.t): The state.
Returns:
- (tuple): The code if the verification is successful.
- (tuple): The error reason if the verification fails.