---
title: "Create an auth token via OAuth."
method: POST
path: "/me/oauth/auth-tokens"
tags: ["me"]
---

# Create an auth token via OAuth.

`POST /me/oauth/auth-tokens`

Create a short-term authentication token using a third-party OAuth provider (e.g., Google).

## Request body

- CreateOAuthAuthTokenRequest
  - `provider` 'google' | 'github' | 'hugging_face', required — The authentication provider used for login. - "google": User logs in with Google OAuth. - "github": User logs in with Github OAuth. - "hugging_face": User logs in with Hugging Face OAuth.
  - `accessToken` string, required — OAuth access token (e.g., Google).

## Response `201`

Successfully created an auth token for user via OAuth.

- CreateOAuthAuthTokenResponse
  - `authToken` string, required — A temporary token issued after the initial login step. This token is used in the create session API to exchange for access and refresh tokens.

## Other responses

- `400` — - [group:**oauth**, code:**0**]: Unsupported OAuth provider. - [group:**oauth**, code:**1**]: Invalid access token. - [group:**request**, code:**0**]: Invalid field in the request body. - [group:**request**, code:**1**]: The request body is required.
- `404` — - [group:**user**, code:**1**]: User does not exist.
- `500` — - [group:**oauth**, code:**1000**]: Get user info encountered error. - [group:**session**, code:**200**]: Failed to create auth token. - [group:**session**, code:**201**]: Failed to save auth token data. - [group:**user**, code:**1200**]: Get user encountered DB error.

---

[API](https://skmtc.net/gmicloud/apis/cluster-engine-api.md) · [All operations](https://skmtc.net/gmicloud/apis/cluster-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gmicloud/cluster-engine-api/versions/bcbab016469f/schema)
