public class AuthorizationCodeInstalledApp : IAuthorizationCodeInstalledApp
Thread-safe OAuth 2.0 authorization code flow for an installed application that persists end-user credentials.
Implements
IAuthorizationCodeInstalledAppNamespace
Google.Apis.Auth.OAuth2Assembly
Google.Apis.Auth.dll
Remarks
Incremental authorization (https://developers.google.com/+/web/api/rest/oauth) is currently not supported for Installed Apps.
Constructors
AuthorizationCodeInstalledApp(IAuthorizationCodeFlow, ICodeReceiver)
public AuthorizationCodeInstalledApp(IAuthorizationCodeFlow flow, ICodeReceiver codeReceiver)
Constructs a new authorization code installed application with the given flow and code receiver.
Parameters | |
---|---|
Name | Description |
flow | IAuthorizationCodeFlow |
codeReceiver | ICodeReceiver |
Properties
CodeReceiver
public ICodeReceiver CodeReceiver { get; }
Gets the code receiver which is responsible for receiving the authorization code.
Property Value | |
---|---|
Type | Description |
ICodeReceiver |
Flow
public IAuthorizationCodeFlow Flow { get; }
Gets the authorization code flow.
Property Value | |
---|---|
Type | Description |
IAuthorizationCodeFlow |
Methods
AuthorizeAsync(String, CancellationToken)
public async Task<UserCredential> AuthorizeAsync(string userId, CancellationToken taskCancellationToken)
Asynchronously authorizes the installed application to access user's protected data.
Parameters | |
---|---|
Name | Description |
userId | String User identifier |
taskCancellationToken | CancellationToken Cancellation token to cancel an operation |
Returns | |
---|---|
Type | Description |
Task<UserCredential> | The user's credential |
ShouldRequestAuthorizationCode(TokenResponse)
public bool ShouldRequestAuthorizationCode(TokenResponse token)
Determines the need for retrieval of a new authorization code, based on the given token and the authorization code flow.
Parameter | |
---|---|
Name | Description |
token | TokenResponse |
Returns | |
---|---|
Type | Description |
Boolean |