GetAuthenticatedUser
client.Users.GetAuthenticatedUser(ctx, body) (*UserGetAuthenticatedUserResponse, error)
POST/gitpod.v1.UserService/GetAuthenticatedUser
Gets information about the currently authenticated user.
Use this method to:
- Get user profile information
- Check authentication status
- Retrieve user settings
- Verify account details
Examples
-
Get current user:
Retrieves details about the authenticated user.
{}
GetAuthenticatedUser
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.Users.GetAuthenticatedUser(context.TODO(), gitpod.UserGetAuthenticatedUserParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.User)
}
{
"user": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"avatarUrl": "avatarUrl",
"createdAt": "2019-12-27T18:11:19.117Z",
"email": "email",
"name": "name",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"status": "USER_STATUS_UNSPECIFIED"
}
}Returns Examples
{
"user": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"avatarUrl": "avatarUrl",
"createdAt": "2019-12-27T18:11:19.117Z",
"email": "email",
"name": "name",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"status": "USER_STATUS_UNSPECIFIED"
}
}