# Class GoogleGrpcCredentials (2.66.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.66.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Auth.GoogleGrpcCredentials)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Auth.GoogleGrpcCredentials)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Auth.GoogleGrpcCredentials)

    public static class GoogleGrpcCredentials

Factory/extension methods to create instances of [ChannelCredentials](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelCredentials) and [CallCredentials](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallCredentials) classes
based on credential objects originating from Google auth library.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> GoogleGrpcCredentials

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Grpc.Auth](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Auth)

## Assembly

Grpc.Auth.dll

## Methods

### FromAccessToken(string)

    public static CallCredentials FromAccessToken(string accessToken)

Creates an instance of [CallCredentials](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallCredentials) that will use given access token to authenticate
with a gRPC service.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `accessToken` | `https://learn.microsoft.com/dotnet/api/system.string` OAuth2 access token. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.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](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelCredentials) that use the default SSL credentials.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelCredentials` | The `ChannelCredentials` instance. |

### ToCallCredentials(ITokenAccess)

    public static CallCredentials ToCallCredentials(this ITokenAccess credential)

Converts a `ITokenAccess` (e.g. `GoogleCredential`) object
into a gRPC [CallCredentials](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallCredentials) object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `credential` | `https://github.com/googleapis/google-api-dotnet-client/blob/5b340dd01c2e6e971f7132c72015d4030eeb2257/Src/Support/Google.Apis.Auth/OAuth2/ITokenAccess.cs` The credential to use to obtain access tokens. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallCredentials` | The `CallCredentials` instance. |

### ToChannelCredentials(ITokenAccess)

    public static ChannelCredentials ToChannelCredentials(this ITokenAccess googleCredential)

Converts a `ITokenAccess` (e.g. `GoogleCredential`) object
into a gRPC [ChannelCredentials](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelCredentials) object.
Default SSL credentials are used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `googleCredential` | `https://github.com/googleapis/google-api-dotnet-client/blob/5b340dd01c2e6e971f7132c72015d4030eeb2257/Src/Support/Google.Apis.Auth/OAuth2/ITokenAccess.cs` The credential to use to obtain access tokens. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelCredentials` | > The `ChannelCredentials` instance. |