GetAuthenticatedIdentity
client.Identity.GetAuthenticatedIdentity(ctx, body) (*IdentityGetAuthenticatedIdentityResponse, error)
POST/gitpod.v1.IdentityService/GetAuthenticatedIdentity
Retrieves information about the currently authenticated identity.
Use this method to:
- Get current user information
- Check authentication status
- Retrieve organization context
- Validate authentication principal
Examples
-
Get current identity:
Retrieves details about the authenticated user.
{}
GetAuthenticatedIdentity
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.GetAuthenticatedIdentity(context.TODO(), gitpod.IdentityGetAuthenticatedIdentityParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.OrganizationID)
}
{
"organizationId": "organizationId",
"organizationTier": "organizationTier",
"subject": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
}
}Returns Examples
{
"organizationId": "organizationId",
"organizationTier": "organizationTier",
"subject": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
}
}