## GetIDToken `client.Identity.GetIDToken(ctx, body) (*IdentityGetIDTokenResponse, error)` **post** `/gitpod.v1.IdentityService/GetIDToken` Gets an ID token for authenticating with other services. Use this method to: - Obtain authentication tokens for service-to-service calls - Access protected resources - Generate scoped access tokens ### Examples - Get token for single service: Retrieves a token for authenticating with one service. ```yaml audience: - "https://api.gitpod.io" ``` - Get token for multiple services: Retrieves a token valid for multiple services. ```yaml audience: - "https://api.gitpod.io" - "https://ws.gitpod.io" ``` ### Parameters - `body IdentityGetIDTokenParams` - `Audience param.Field[[]string]` - `Version param.Field[IDTokenVersion]` version is the version of the ID token. ### Returns - `type IdentityGetIDTokenResponse struct{…}` - `Token string` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Identity.GetIDToken(context.TODO(), gitpod.IdentityGetIDTokenParams{ Audience: gitpod.F([]string{"https://api.gitpod.io", "https://ws.gitpod.io"}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Token) } ``` #### Response ```json { "token": "token" } ```