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
optionsAuth0ClientOptionsAuth0ClientOptions specifying the configuration options for this client.
platformNamestringPlatform 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
accessTokenstringAccess token to use in obtaining claims.
Returns
- Task<UserInfoResult>
A IdentityModel.OidcClient.Results.UserInfoResult with the user information and claims.
Exceptions
- ArgumentNullException
When
accessTokenis 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
extraParametersobjectOptional extra parameters that need to be passed to the endpoint.
cancellationTokenCancellationTokenOptional 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
federatedboolWhether to log the user out of their federated identity provider. Defaults to false.
extraParametersobjectOptional extra parameters that need to be passed to the endpoint.
cancellationTokenCancellationTokenOptional 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
extraParametersobjectOptional extra parameters that need to be passed to the endpoint.
cancellationTokenCancellationTokenOptional 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
datastringThe data containing the full redirect URI.
stateAuthorizeStateThe IdentityModel.OidcClient.AuthorizeState which was generated when the PrepareLoginAsync(object, CancellationToken) method was called.
extraParametersobjectOptional extra parameters that need to be passed to the endpoint.
cancellationTokenCancellationTokenOptional 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
refreshTokenstringRefresh token which was issued during the authorization flow, or subsequent calls to RefreshTokenAsync(string, Parameters, string, CancellationToken).
extraParametersobjectOptional extra parameters that need to be passed to the endpoint.
cancellationTokenCancellationTokenOptional 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
refreshTokenstringRefresh token which was issued during the authorization flow, or subsequent calls to RefreshTokenAsync(string, Parameters, string, CancellationToken).
scopestringSpace separated list of the requested scopes.
extraParametersobjectOptional extra parameters that need to be passed to the endpoint.
cancellationTokenCancellationTokenOptional 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
refreshTokenstringRefresh token which was issued during the authorization flow, or subsequent calls to RefreshTokenAsync(string, Parameters, string, CancellationToken).
cancellationTokenCancellationTokenOptional CancellationToken that can be used to cancel the request.
Returns
- Task<RefreshTokenResult>
A IdentityModel.OidcClient.LoginResult containing the tokens and claims.