Class LocalServerCodeReceiver
OAuth 2.0 verification code receiver that runs a local server on a free port and waits for a call with the authorization verification code.
Implements
Inherited Members
Namespace: Google.Apis.Auth.OAuth2
Assembly: Google.Apis.Auth.dll
Syntax
public class LocalServerCodeReceiver : ICodeReceiver
Constructors
LocalServerCodeReceiver()
Create an instance of LocalServerCodeReceiver.
Declaration
public LocalServerCodeReceiver()
LocalServerCodeReceiver(string)
Create an instance of LocalServerCodeReceiver.
Declaration
public LocalServerCodeReceiver(string closePageResponse)
Parameters
Type | Name | Description |
---|---|---|
string | closePageResponse | Custom close page response for this instance |
LocalServerCodeReceiver(string, CallbackUriChooserStrategy)
Create an instance of LocalServerCodeReceiver.
Declaration
public LocalServerCodeReceiver(string closePageResponse, LocalServerCodeReceiver.CallbackUriChooserStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
string | closePageResponse | Custom close page response for this instance |
LocalServerCodeReceiver.CallbackUriChooserStrategy | strategy | The strategy to use to determine the callback URI |
Properties
RedirectUri
Gets the redirected URI.
Declaration
public string RedirectUri { get; }
Property Value
Type | Description |
---|---|
string |
Methods
OpenBrowser(string)
Open a browser and navigate to a URL.
Declaration
protected virtual bool OpenBrowser(string url)
Parameters
Type | Name | Description |
---|---|---|
string | url | URL to navigate to |
Returns
Type | Description |
---|---|
bool | true if browser was launched successfully, false otherwise |
ReceiveCodeAsync(AuthorizationCodeRequestUrl, CancellationToken)
Receives the authorization code.
Declaration
public Task<AuthorizationCodeResponseUrl> ReceiveCodeAsync(AuthorizationCodeRequestUrl url, CancellationToken taskCancellationToken)
Parameters
Type | Name | Description |
---|---|---|
AuthorizationCodeRequestUrl | url | The authorization code request URL |
CancellationToken | taskCancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<AuthorizationCodeResponseUrl> | The authorization code response |