Xsolla-logo
  • 문서화
  • 계정 생성

JWT 생성하기

post/oauth2/token

Use this call:

  • To get a user JWT.
  • To refresh the JWT when it expires. Works only if scope=offline is passed in the registration or authentication call.
  • To get a server JWT. The user participation isn’t needed.
  • To exchange user JWT for a new one with different scope.

Usage of this call depends on the value of the grant_type parameter.

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

The type of getting the JWT. Can be:

  • authorization_code to exchange the code received in the authentication call to the JWT. The value of the code parameter must be specified.
  • refresh_token to get the refreshed JWT when the previous value is expired. The value of the refresh_token parameter must be specified.
  • client_credentials to get the server JWT. The values of the client_id and client_secret parameters must be specified.
  • urn:ietf:params:oauth:grant-type:token_exchange to exchange existing user JWT with different scope.
client_id
required
string

애플리케이션 ID입니다. 이 매개변수의 값은 grant_type 매개변수의 값에 따라 달라집니다.

client_secretclient_id 매개변수의 값은 동일한 클라이언트에서 사용해야 합니다.

refresh_token
string

grant_type 매개변수의 authorization_code 또는 refresh_token 값을 갖는 이 호출의 마지막 요청에 대한 응답으로 수신한 이 매개변수의 값입니다. 'grant_type=refresh_token'인 경우 필수입니다.

client_secret
string

비밀 키입니다. 이 매개변수의 값은 grant_type 매개변수의 값에 따라 달라집니다.

  • authorization_code인 경우. OAuth 2.0 클라이언트를 생성하고 해당 비밀 키를 사용합니다. 기밀 인증 유형으로 OAuth 2.0 클라이언트를 생성한 경우 필수입니다.
  • client_credentials인 경우. 서버 OAuth 2.0 클라이언트를 생성하고 해당 비밀 키를 가져오려면 고객 성공 매니저에게 문의해야 합니다. 이 클라이언트 유형은 필수입니다.

client_secretclient_id 매개변수의 값은 동일한 클라이언트에서 사용해야 합니다.

redirect_uri
string
code
string

JWT로 교환되는 인증 코드입니다. 'grant_type=authorization_code'인 경우 필수입니다.

code_verifier
string

인증 요청 전에 앱이 원래 생성한 PKCE 요청에 대한 코드 검증 도구입니다.

audience
string

토큰을 적용할 수 있는 도메인 목록

scope
string

A list of space-delimited, case-sensitive strings, as defined in Section 3.3 of [RFC6749], that allow the client to specify the desired scope of the requested security token in the context of the service or resource where the token will be used. The values and associated semantics of scope are service specific and expected to be described in the relevant service documentation

subject_token
string

A security token that represents the identity of the party on behalf of whom the request is being made. Typically, the subject of this token will be the subject of the security token issued in response to the request.

subject_token_type
string

A security token that represents the identity of the party on behalf of whom the request is being made. Typically, the subject of this token will be the subject of the security token issued in response to the request.

Value: "access_token"
actor_token
string

A security token that represents the identity of the acting party. Typically, this will be the party that is authorized to use the requested security token and act on behalf of the subject.

actor_token_type
string

An identifier, as described in Section 3, that indicates the type of the security token in the actor_token parameter. This is REQUIRED when the actor_token parameter is present in the request but MUST NOT be included otherwise.

Value: "server_token"
Responses
200

확인

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&audience=string&scope=string&subject_token=string&subject_token_type=access_token&actor_token=string&actor_token_type=server_token
Response samples
application/json
{
  • "access_token": "2YotnFZFEjr1zCsicMWpAA",
  • "expires_in": 3600,
  • "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",
  • "scope": "email user_profile",
  • "token_type": "bearer"
}