public class LocalServerCodeReceiver : ICodeReceiverOAuth 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
ICodeReceiverNamespace
Google.Apis.Auth.OAuth2Assembly
Google.Apis.Auth.dll
Constructors
LocalServerCodeReceiver()
public LocalServerCodeReceiver()Create an instance of LocalServerCodeReceiver.
LocalServerCodeReceiver(string)
public LocalServerCodeReceiver(string closePageResponse)Create an instance of LocalServerCodeReceiver.
| Parameter | |
|---|---|
| Name | Description |
closePageResponse |
stringCustom close page response for this instance |
LocalServerCodeReceiver(string, CallbackUriChooserStrategy)
public LocalServerCodeReceiver(string closePageResponse, LocalServerCodeReceiver.CallbackUriChooserStrategy strategy)Create an instance of LocalServerCodeReceiver.
| Parameters | |
|---|---|
| Name | Description |
closePageResponse |
stringCustom close page response for this instance |
strategy |
LocalServerCodeReceiverCallbackUriChooserStrategyThe strategy to use to determine the callback URI |
Properties
RedirectUri
public string RedirectUri { get; }Gets the redirected URI.
| Property Value | |
|---|---|
| Type | Description |
string |
|
Methods
OpenBrowser(string)
protected virtual bool OpenBrowser(string url)Open a browser and navigate to a URL.
| Parameter | |
|---|---|
| Name | Description |
url |
stringURL to navigate to |
| Returns | |
|---|---|
| Type | Description |
bool |
true if browser was launched successfully, false otherwise |
ReceiveCodeAsync(AuthorizationCodeRequestUrl, CancellationToken)
public Task<AuthorizationCodeResponseUrl> ReceiveCodeAsync(AuthorizationCodeRequestUrl url, CancellationToken taskCancellationToken)Receives the authorization code.
| Parameters | |
|---|---|
| Name | Description |
url |
AuthorizationCodeRequestUrlThe authorization code request URL |
taskCancellationToken |
CancellationTokenCancellation token |
| Returns | |
|---|---|
| Type | Description |
TaskAuthorizationCodeResponseUrl |
The authorization code response |