Interface IAuthorizationCodeFlow
OAuth 2.0 authorization code flow that manages and persists end-user credentials.
Inherited Members
Namespace: Google.Apis.Auth.OAuth2.Flows
Assembly: Google.Apis.Auth.dll
Syntax
public interface IAuthorizationCodeFlow : IDisposable
Properties
AccessMethod
Gets the method for presenting the access token to the resource server.
Declaration
IAccessMethod AccessMethod { get; }
Property Value
Type | Description |
---|---|
IAccessMethod |
Clock
Gets the clock.
Declaration
IClock Clock { get; }
Property Value
Type | Description |
---|---|
Google.Apis.Util.IClock |
DataStore
Gets the data store used to store the credentials.
Declaration
IDataStore DataStore { get; }
Property Value
Type | Description |
---|---|
Google.Apis.Util.Store.IDataStore |
Methods
CreateAuthorizationCodeRequest(String)
Creates an authorization code request with the specified redirect URI.
Declaration
AuthorizationCodeRequestUrl CreateAuthorizationCodeRequest(string redirectUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectUri |
Returns
Type | Description |
---|---|
AuthorizationCodeRequestUrl |
DeleteTokenAsync(String, CancellationToken)
Asynchronously deletes the user's token using the flow's Google.Apis.Util.Store.IDataStore.
Declaration
Task DeleteTokenAsync(string userId, CancellationToken taskCancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | User identifier. |
System.Threading.CancellationToken | taskCancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ExchangeCodeForTokenAsync(String, String, String, CancellationToken)
Asynchronously exchanges code with a token.
Declaration
Task<TokenResponse> ExchangeCodeForTokenAsync(string userId, string code, string redirectUri, CancellationToken taskCancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | User identifier. |
System.String | code | Authorization code received from the authorization server. |
System.String | redirectUri | Redirect URI which is used in the token request. |
System.Threading.CancellationToken | taskCancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TokenResponse> | Token response which contains the access token. |
LoadTokenAsync(String, CancellationToken)
Asynchronously loads the user's token using the flow's Google.Apis.Util.Store.IDataStore.
Declaration
Task<TokenResponse> LoadTokenAsync(string userId, CancellationToken taskCancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | User identifier |
System.Threading.CancellationToken | taskCancellationToken | Cancellation token to cancel operation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TokenResponse> | Token response |
RefreshTokenAsync(String, String, CancellationToken)
Asynchronously refreshes an access token using a refresh token.
Declaration
Task<TokenResponse> RefreshTokenAsync(string userId, string refreshToken, CancellationToken taskCancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | User identifier. |
System.String | refreshToken | Refresh token which is used to get a new access token. |
System.Threading.CancellationToken | taskCancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TokenResponse> | Token response which contains the access token and the input refresh token. |
RevokeTokenAsync(String, String, CancellationToken)
Asynchronously revokes the specified token. This method disconnects the user's account from the OAuth 2.0 application. It should be called upon removing the user account from the site.
Declaration
Task RevokeTokenAsync(string userId, string token, CancellationToken taskCancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | User identifier. |
System.String | token | Access token to be revoked. |
System.Threading.CancellationToken | taskCancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
|
Remarks
If revoking the token succeeds, the user's credential is removed from the data store and the user MUST authorize the application again before the application can access the user's private resources.
ShouldForceTokenRetrieval()
Indicates if a new token needs to be retrieved and stored regardless of normal circumstances.
Declaration
bool ShouldForceTokenRetrieval()
Returns
Type | Description |
---|---|
System.Boolean |