Class GoogleGrpcCredentials
Factory/extension methods to create instances of ChannelCredentials and CallCredentials classes based on credential objects originating from Google auth library.
Inheritance
Inherited Members
Namespace: Grpc.Auth
Assembly: Grpc.Auth.dll
Syntax
public static class GoogleGrpcCredentials
Methods
FromAccessToken(String)
Creates an instance of CallCredentials that will use given access token to authenticate with a gRPC service.
Declaration
public static CallCredentials FromAccessToken(string accessToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | accessToken | OAuth2 access token. |
Returns
| Type | Description |
|---|---|
| CallCredentials | The |
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.
Declaration
public static Task<ChannelCredentials> GetApplicationDefaultAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ChannelCredentials> | The |
ToCallCredentials(ITokenAccess)
Converts a ITokenAccess (e.g. GoogleCredential) object
into a gRPC CallCredentials object.
Declaration
public static CallCredentials ToCallCredentials(this ITokenAccess credential)
Parameters
| Type | Name | Description |
|---|---|---|
| ITokenAccess | credential | The credential to use to obtain access tokens. |
Returns
| Type | Description |
|---|---|
| CallCredentials | The |
ToChannelCredentials(ITokenAccess)
Converts a ITokenAccess (e.g. GoogleCredential) object
into a gRPC ChannelCredentials object.
Default SSL credentials are used.
Declaration
public static ChannelCredentials ToChannelCredentials(this ITokenAccess googleCredential)
Parameters
| Type | Name | Description |
|---|---|---|
| ITokenAccess | googleCredential | The credential to use to obtain access tokens. |
Returns
| Type | Description |
|---|---|
| ChannelCredentials |
|