Table of Contents

Interface IAuth0Client

Namespace
Auth0.OidcClient
Assembly
Auth0.OidcClient.Core.dll

Interface for performing authentication and authorization operations with Auth0 using the underlying IdentityModel.OidcClient.OidcClient.

public interface IAuth0Client

Methods

GetUserInfoAsync(string)

Gets the user claims from the userinfo endpoint.

Task<UserInfoResult> GetUserInfoAsync(string accessToken)

Parameters

accessToken string

Access token to use in obtaining claims.

Returns

Task<UserInfoResult>

A IdentityModel.OidcClient.Results.UserInfoResult with the user information and claims.

Exceptions

ArgumentNullException

When accessToken is null.

InvalidOperationException

When no userinfo endpoint specified.

LoginAsync(object, CancellationToken)

Launches a browser to log the user in.

Task<LoginResult> LoginAsync(object extraParameters = null, CancellationToken cancellationToken = default)

Parameters

extraParameters object

Optional extra parameters that need to be passed to the endpoint.

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<LoginResult>

A IdentityModel.OidcClient.LoginResult containing the tokens and claims.

LogoutAsync(bool, object, CancellationToken)

Launches a browser to log the user out and clear the Auth0 SSO Cookie.

Task<BrowserResultType> LogoutAsync(bool federated = false, object extraParameters = null, CancellationToken cancellationToken = default)

Parameters

federated bool

Whether to log the user out of their federated identity provider. Defaults to false.

extraParameters object

Optional extra parameters that need to be passed to the endpoint.

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<BrowserResultType>

A IdentityModel.OidcClient.Browser.BrowserResultType indicating whether the logout was successful.

PrepareLoginAsync(object, CancellationToken)

Generates an IdentityModel.OidcClient.AuthorizeState containing the URL, state, nonce and code challenge which can be used to redirect the user to the authorization URL, and subsequently process any response by calling the ProcessResponseAsync(string, AuthorizeState, object, CancellationToken) method.

Task<AuthorizeState> PrepareLoginAsync(object extraParameters = null, CancellationToken cancellationToken = default)

Parameters

extraParameters object

Optional extra parameters that need to be passed to the endpoint.

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<AuthorizeState>

A IdentityModel.OidcClient.AuthorizeState with necessary URLs, nonce, state and code verifiers.

ProcessResponseAsync(string, AuthorizeState, object, CancellationToken)

Process the response from the Auth0 redirect URI.

Task<LoginResult> ProcessResponseAsync(string data, AuthorizeState state, object extraParameters = null, CancellationToken cancellationToken = default)

Parameters

data string

The data containing the full redirect URI.

state AuthorizeState

The IdentityModel.OidcClient.AuthorizeState which was generated when the PrepareLoginAsync(object, CancellationToken) method was called.

extraParameters object

Optional extra parameters that need to be passed to the endpoint.

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<LoginResult>

A IdentityModel.OidcClient.LoginResult containing the tokens and claims.

RefreshTokenAsync(string, object, CancellationToken)

Generates a new set of tokens based on a refresh token.

Task<RefreshTokenResult> RefreshTokenAsync(string refreshToken, object extraParameters = null, CancellationToken cancellationToken = default)

Parameters

refreshToken string

Refresh token which was issued during the authorization flow, or subsequent calls to IdentityModel.OidcClient.OidcClient.RefreshTokenAsync(System.String,IdentityModel.Client.Parameters,System.String,System.Threading.CancellationToken).

extraParameters object

Optional extra parameters that need to be passed to the endpoint.

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<RefreshTokenResult>

A IdentityModel.OidcClient.Results.RefreshTokenResult with the refreshed tokens.

RefreshTokenAsync(string, string, object, CancellationToken)

Generates a new set of tokens based on a refresh token.

Task<RefreshTokenResult> RefreshTokenAsync(string refreshToken, string scope, object extraParameters = null, CancellationToken cancellationToken = default)

Parameters

refreshToken string

Refresh token which was issued during the authorization flow, or subsequent calls to IdentityModel.OidcClient.OidcClient.RefreshTokenAsync(System.String,IdentityModel.Client.Parameters,System.String,System.Threading.CancellationToken).

scope string

Space separated list of the requested scopes.

extraParameters object

Optional extra parameters that need to be passed to the endpoint.

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<RefreshTokenResult>

A IdentityModel.OidcClient.Results.RefreshTokenResult with the refreshed tokens.

RefreshTokenAsync(string, CancellationToken)

Generates a new set of tokens based on a refresh token.

Task<RefreshTokenResult> RefreshTokenAsync(string refreshToken, CancellationToken cancellationToken = default)

Parameters

refreshToken string

Refresh token which was issued during the authorization flow, or subsequent calls to IdentityModel.OidcClient.OidcClient.RefreshTokenAsync(System.String,IdentityModel.Client.Parameters,System.String,System.Threading.CancellationToken).

cancellationToken CancellationToken

Optional CancellationToken that can be used to cancel the request.

Returns

Task<RefreshTokenResult>

A IdentityModel.OidcClient.LoginResult containing the tokens and claims.