Class GoogleGrpcCredentials (2.48.0)

public static class GoogleGrpcCredentials : object

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
NameDescription
accessTokenString

OAuth2 access token.

Returns
TypeDescription
CallCredentials

The CallCredentials instance.

GetApplicationDefaultAsync()

public static async 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
TypeDescription
Task<ChannelCredentials>

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
NameDescription
credentialITokenAccess

The credential to use to obtain access tokens.

Returns
TypeDescription
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
NameDescription
googleCredentialITokenAccess

The credential to use to obtain access tokens.

Returns
TypeDescription
ChannelCredentials

The ChannelCredentials instance.