Class CredentialFactory (1.73.0)

public static class CredentialFactory

A Google credential factory.

Inheritance

object > CredentialFactory

Namespace

Google.Apis.Auth.OAuth2

Assembly

Google.Apis.Auth.dll

Methods

FromFile(string, string)

public static GoogleCredential FromFile(string credentialPath, string credentialType)

Creates a credential of the specified type from a file that contains JSON credential data.

Parameters
Name Description
credentialPath string

The path to the credential file.

credentialType string

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)

public static Task<GoogleCredential> FromFileAsync(string credentialPath, string credentialType, CancellationToken cancellationToken)

Creates a credential of the specified type from a file that contains JSON credential data.

Parameters
Name Description
credentialPath string

The path to the credential file.

credentialType string

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
TaskGoogleCredential

The created credential.

FromFileAsync<T>(string, CancellationToken)

public static Task<T> FromFileAsync<T>(string credentialPath, CancellationToken cancellationToken)

Creates a credential of the specified type from a file that contains JSON credential data.

Parameters
Name Description
credentialPath string

The path to the credential file.

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns
Type Description
Task

A task that will be completed with the created credential.

Type Parameter
Name Description
T

The type of the credential to create.

FromFile<T>(string)

public static T FromFile<T>(string credentialPath)

Creates a credential of the specified type from a file that contains JSON credential data.

Parameter
Name Description
credentialPath string

The path to the credential file.

Returns
Type Description
T

The created credential.

Type Parameter
Name Description
T

The type of the credential to create.

FromJson(string, string)

public static GoogleCredential FromJson(string json, string credentialType)

Creates a credential of the specified type from a string that contains JSON credential data.

Parameters
Name Description
json string

The string that contains the JSON credential data.

credentialType string

The type of credential to be loaded. Valid strings can be found in JsonCredentialParameters.

Returns
Type Description
GoogleCredential

The created credential.

FromJson<T>(string)

public static T FromJson<T>(string json)

Creates a credential of the specified type from a string that contains JSON credential data.

Parameter
Name Description
json string

The string that contains the JSON credential data.

Returns
Type Description
T

The created credential.

Type Parameter
Name Description
T

The type of the credential to create.

FromStreamAsync<T>(Stream, CancellationToken)

public static Task<T> FromStreamAsync<T>(Stream stream, CancellationToken cancellationToken)

Creates a credential of the specified type from a stream that contains JSON credential data.

Parameters
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

A task that will be completed with the created credential.

Type Parameter
Name Description
T

The type of the credential to create.

FromStream<T>(Stream)

public static T FromStream<T>(Stream stream)

Creates a credential of the specified type from a stream that contains JSON credential data.

Parameter
Name Description
stream Stream

The stream that contains the JSON credential data.

Returns
Type Description
T

The created credential.

Type Parameter
Name Description
T

The type of the credential to create.