Table of Contents

Class Auth0ClientBase

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

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

public abstract class Auth0ClientBase : IAuth0Client
Inheritance
Auth0ClientBase
Implements
Derived
Inherited Members

Constructors

Auth0ClientBase(Auth0ClientOptions, string)

Create a new instance of Auth0ClientBase.

protected Auth0ClientBase(Auth0ClientOptions options, string platformName)

Parameters

options Auth0ClientOptions

Auth0ClientOptions specifying the configuration options for this client.

platformName string

Platform name that forms part of the user-agent when communicating with Auth0 servers.

Methods

GetUserInfoAsync(string)

Gets the user claims from the userinfo endpoint.

public 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.

public 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.

public 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.

public 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.

public 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.

public Task<RefreshTokenResult> RefreshTokenAsync(string refreshToken, object extraParameters, 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.

public 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.

public 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.