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
Name Description
accessToken String

OAuth2 access token.

Returns
Type Description
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
Type Description
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
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.