Xsolla-logo

JWTを生成する

post/oauth2/token

次のコールを使用して以下のことができます:

  • ユーザーJWTを取得すること。
  • JWTが期限切れになったときにリフレッシュすること。登録または認証コールで scope=offline が渡された場合にのみ機能します。
  • サーバーJWTを取得すること。ユーザーの参加は必要ありません。

このコールの使用方法は、grant_typeパラメータの値に依存します。

Request
Request Body schema: application/x-www-form-urlencoded
grant_type
required
string

JWTを取得するタイプ。以下の値を指定できます:

  • authorization_codeは、認証コールで受け取ったコードをJWTに交換します。codeパラメータの値を指定する必要があります。
  • refresh_token前の値の有効期限が切れたときにリフレッシュされたJWTを取得します。refresh_tokenパラメータの値を指定する必要があります。
  • client_credentialsはサーバーJWTを取得します。client_idclient_secretパラメータの値を指定する必要があります。
client_id
required
string

Your application ID. The value for this parameter depends on the value of the grant_type parameter:

Note that values for client_secret and client_id parameters should be used from the same client.

refresh_token
string

grant_typeパラメータにauthorization_codeまたはrefresh_token値を持つ、このコールの最後リクエストに対する応答で受け取ったパラメータの値。grant_type=refresh_token`の場合は、必須です。

client_secret
string

Your secret key. The value for this parameter depends on the value of the grant_type parameter:

  • If it’s authorization_code, create an OAuth 2.0 client and use its secret key. Required if you created an OAuth 2.0 client with confidential authentication type.
  • If it’s client_credentials, contact your Customer Success Manager to create a server OAuth 2.0 client and get its secret key. Required for this client type.

Note that values for client_secret and client_id parameters should be used from the same client.

redirect_uri
string
code
string

JWTに交換される認証コード。grant_type=authorization_codeの場合は、必須です。

code_verifier
string

The code verifier for the PKCE request, that the app originally generated before the authorization request.

Responses
200

OK

400

無効なリクエスト

404

見つかりません

418

私はティーポット

422

処理不可能なエンティティー

429

リクエストの回数が多すぎます

Request samples
application/x-www-form-urlencoded
refresh_token=string&grant_type=string&client_secret=string&client_id=string&redirect_uri=string&code=string&code_verifier=string
Response samples
application/json
{
  • "access_token": "2YotnFZFEjr1zCsicMWpAA",
  • "expires_in": 3600,
  • "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",
  • "scope": "email user_profile",
  • "token_type": "bearer"
}