Class GoogleGrpcCredentials (2.66.0)

public static class GoogleGrpcCredentials

Factory/extension methods to create instances of ChannelCredentials and CallCredentials classes based on credential objects originating from Google auth library.

Inheritance

object > GoogleGrpcCredentials

Namespace

Grpc.Auth

Assembly

Grpc.Auth.dll

Methods

FromAccessToken(string)

public static CallCredentials FromAccessToken(string accessToken)

Creates an instance of CallCredentials that will use given access token to authenticate with a gRPC service.

Parameter
Name Description
accessToken string

OAuth2 access token.

Returns
Type Description
CallCredentials

The CallCredentials instance.

GetApplicationDefaultAsync()

public static Task<ChannelCredentials> GetApplicationDefaultAsync()

Retrieves an instance of Google's Application Default Credentials using GoogleCredential.GetApplicationDefaultAsync() and converts them into a gRPC ChannelCredentials that use the default SSL credentials.

Returns
Type Description
TaskChannelCredentials

The ChannelCredentials instance.

ToCallCredentials(ITokenAccess)

public static CallCredentials ToCallCredentials(this ITokenAccess credential)

Converts a ITokenAccess (e.g. GoogleCredential) object into a gRPC CallCredentials object.

Parameter
Name Description
credential ITokenAccess

The credential to use to obtain access tokens.

Returns
Type Description
CallCredentials

The CallCredentials instance.

ToChannelCredentials(ITokenAccess)

public static ChannelCredentials ToChannelCredentials(this ITokenAccess googleCredential)

Converts a ITokenAccess (e.g. GoogleCredential) object into a gRPC ChannelCredentials object. Default SSL credentials are used.

Parameter
Name Description
googleCredential ITokenAccess

The credential to use to obtain access tokens.

Returns
Type Description
ChannelCredentials

The ChannelCredentials instance.