public static class GoogleGrpcCredentials
Factory/extension methods to create instances of ChannelCredentials and CallCredentials classes based on credential objects originating from Google auth library.
Namespace
Grpc.AuthAssembly
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 |
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 |
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 |
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 |
|