Class CredentialFactory
A Google credential factory.
Inherited Members
Namespace: Google.Apis.Auth.OAuth2
Assembly: Google.Apis.Auth.dll
Syntax
public static class CredentialFactory
Methods
FromFile(string, string)
Creates a credential of the specified type from a file that contains JSON credential data.
Declaration
public static GoogleCredential FromFile(string credentialPath, string credentialType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | credentialPath | The path to the credential file. |
| string | credentialType | The type of credential to be loaded. Valid strings can be found in JsonCredentialParameters. |
Returns
| Type | Description |
|---|---|
| GoogleCredential | The created credential. |
FromFileAsync(string, string, CancellationToken)
Creates a credential of the specified type from a file that contains JSON credential data.
Declaration
public static Task<GoogleCredential> FromFileAsync(string credentialPath, string credentialType, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | credentialPath | The path to the credential file. |
| string | credentialType | The type of credential to be loaded. Valid strings can be found in JsonCredentialParameters. |
| CancellationToken | cancellationToken | The cancellation token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<GoogleCredential> | The created credential. |
FromFileAsync<T>(string, CancellationToken)
Creates a credential of the specified type from a file that contains JSON credential data.
Declaration
public static Task<T> FromFileAsync<T>(string credentialPath, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | credentialPath | The path to the credential file. |
| CancellationToken | cancellationToken | The cancellation token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<T> | A task that will be completed with the created credential. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the credential to create. |
FromFile<T>(string)
Creates a credential of the specified type from a file that contains JSON credential data.
Declaration
public static T FromFile<T>(string credentialPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | credentialPath | The path to the credential file. |
Returns
| Type | Description |
|---|---|
| T | The created credential. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the credential to create. |
FromJson(string, string)
Creates a credential of the specified type from a string that contains JSON credential data.
Declaration
public static GoogleCredential FromJson(string json, string credentialType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | json | The string that contains the JSON credential data. |
| string | credentialType | The type of credential to be loaded. Valid strings can be found in JsonCredentialParameters. |
Returns
| Type | Description |
|---|---|
| GoogleCredential | The created credential. |
FromJson<T>(string)
Creates a credential of the specified type from a string that contains JSON credential data.
Declaration
public static T FromJson<T>(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| string | json | The string that contains the JSON credential data. |
Returns
| Type | Description |
|---|---|
| T | The created credential. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the credential to create. |
FromStreamAsync<T>(Stream, CancellationToken)
Creates a credential of the specified type from a stream that contains JSON credential data.
Declaration
public static Task<T> FromStreamAsync<T>(Stream stream, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream that contains the JSON credential data. |
| CancellationToken | cancellationToken | The cancellation token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<T> | A task that will be completed with the created credential. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the credential to create. |
FromStream<T>(Stream)
Creates a credential of the specified type from a stream that contains JSON credential data.
Declaration
public static T FromStream<T>(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream that contains the JSON credential data. |
Returns
| Type | Description |
|---|---|
| T | The created credential. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the credential to create. |