Xsolla-logoXsolla Developers
または
パブリッシャーアカウントへ

概要

このセクションでは、ログイン を操作するための API 呼び出しについて説明します。リクエストを送信する前に、パブリッシャー アカウント でログイン プロジェクトを セットアップ してください。

IP addresses

The full list of IP addresses that login.xsolla.com may use:

  • 34.94.0.85
  • 34.94.14.95
  • 34.94.25.33
  • 34.94.115.185
  • 34.94.154.26
  • 34.94.173.132
  • 34.102.48.30
  • 35.235.99.248
  • 35.236.32.131
  • 35.236.35.100
  • 35.236.117.164

API定義をダウンロードする

API定義を2つの形式でダウンロードできます:

用語集

アドミンページでは、次のログインプロジェクトタイプにアクセスできます:

  • 標準ログインプロジェクト
  • シャドウログインプロジェクト

詳細については、クロスプラットフォームアカウント機能を参照してください。

レート制限

Are the restrictions applied by Xsolla API on the frequency of access by a user within a defined timeframe.

標準ログインプロジェクト

メインアカウントを保存するために使用されるログインプロジェクトです。

シャドウログインプロジェクト

プラットフォームアカウントを保存するために使用されるログインプロジェクトです。

メインアカウント

標準ログインプロジェクトで作成され、プラットフォームアカウントにリンクされているアカウントタイプです。メインアカウントは、異なるプラットフォームでプレーヤーを識 別するために使用されます。

プラットフォームアカウント

シャドウログインプロジェクトで作成され、確定したパブリッシングプラットフォームに接続されるアカウントタイプです。プラットフォームアカウントは、他のプラットフォー ムアカウントとリンクすることはできません。また、メインアカウントからアカウントのリンクを解除することもできません。

パブリッシングプラットフォーム

ゲームの配布に使用されるゲームプラットフォームです(Steam、PlayStation、Xboxなど)。

認証

Login APIは、以下のトークンタイプをサポートしています:

Authentication schemes

認証スキームによって、APIコールがクライアント側かサーバー側かを判断できます:

  • Client-side — are called without authentication or with the Authorization header: Bearer <user_JWT> header, where <user_JWT> — is the user token.
  • Server-side API calls for implementing the user flow — are called with the header: X-SERVER-AUTHORIZATION: <server_JWT>, where <server_JWT> — is the server token.

ユーザートークンの取得

トークンを取得するには、次のいずれかのリクエストを送信します:

JWT認証後、ユーザーはクエリパラメータにトークンを含むコールバックURLにリダイレクトされます:<Callback URL>?token=<User token (JWT)>

After OAuth 2.0 protocol-based authentication, send the Generate JWT POST request to the Xsolla Login server to exchange the received code parameter for a user token (access_token).

When the access token expires, the client sends Generate JWT POST request endpoint on the Xsolla Login server. The request body must include the following parameters:

  • grant_type — JWT grant type, pass the refresh_token value.
  • client_id — OAuth 2.0 client ID.
  • refresh_token — refresh token received in response to the user authorization request.

サーバートークンの取得

サーバートークンを取得するには:

  1. サーバーOAuth 2.0クライアントをセットアップする
  2. サーバーJWTを生成する

サーバーOAuth 2.0クライアントをセットアップする

  1. パブリッシャーアカウントでプロジェクトを開き、ログインセクションに移動します。
  2. ログインプロジェクトのパネルで構成をクリックします。
  3. セキュリティブロックに移動し、OAuth 2.0セクションを選択します。
  4. Click Add OAuth 2.0 Client.
  5. **サーバー (server-to-server connection)**ボックスのチェックを入れます。
  6. トークンの有効期間を指定します。
  7. 接続をクリックします。
  8. クライアントIDと秘密キーをコピーして保存します。

サーバーJWTを生成

アプリケーションのバックエンドで、JWT APIを生成するコールを使用してサーバーJWTを取得するメソッドを実装します。リクエストには次のパラメータが含まれている必要があります。

  • grant_type is the type of getting JWT, pass the client_credentials value.
  • client_secret is the secret key that is received when you set up the server OAuth 2.0 client.
  • client_id is the client ID received when you set up the server OAuth 2.0 client.

When the server token expires, generate a new token using the Generate JWT API call. The request body must include the following parameters:

  • grant_type — JWT grant type, pass the client_credentials value.
  • client_id — OAuth 2.0 client ID.
  • client_secret — OAuth 2.0 client secret key.

レート制限

To prevent Xsolla system overloads and protect against sudden spikes in incoming traffic, Xsolla limits the number of requests received by the Xsolla API within a specified period of time. If the limit is exceeded, the Xsolla API returns an HTTP response with the 429 status code.

Rate limits vary by method, IP-address, authentication scheme, and other factors.

Rate limits for server-side methods are applied to methods with server-side authentication — methods that are called with the X-SERVER-AUTHORIZATION: <server_JWT> header, where <server_JWT> is the server token.

Rate limits for client-side methods are applied to methods without authentication or with client-side authentication — methods that are called with the Authorization: Bearer <user_JWT> header, where <user_JWT> is the user token.

Example of a method with server-side authentication: Example of a 
method with server-side 
authentication Example of a method with client-side authentication: Example of a method with server-side 
authentication

Rate limits for client-side methods do not change and are necessary to prevent brute-force attacks. The maximum request rate for server-side methods is higher than for client-side methods. You can refer to the recommendations on how to manage rate limits in the documentation.

Note In certain cases, it is possible to adjust the rate limits by request. To request the rate limits adjustment, contact your Customer Success Manager or email csm@xsolla.com.

JWT構造

すべてのトークンにはJWTフォーマットがあり、ペイロードに明確な情報が含まれています。

ユーザーJWT

ユーザーJWTは、認証または登録の結果として受け取ったトークンです。トークンのペイロードには、ユーザーと認証のコールに関する情報が含まれています。

OAuth 2.0プロトコルでユーザートークンを取得するには、OAuth 2.0クライアントが必要です。ユーザートークンは、Authorization: Bearer <JWT>ヘッダで渡されます。

主な要求

トークンには、認証またはメールアドレス確認後の主な要求が含まれます。これらの要求の有無は、ユーザーデータベースや認証コールに依存しません。

 
クレーム タイプ 必須 説明
exp Unixタイムスタンプ はい トークンの有効期限を設定する日時。デフォルトの有効期限は24時間です。有効期限は、ログインプロジェクトごとに変更できます。
iss 文字列 はい トークンに署名したサービス:https://login.xsolla.com
iat Unixタイムスタンプ はい トークンを発行した日時。
sub 文字列(UUID) はい エクソーラログインサーバー側に書き込まれたユーザーID。
groups 配列 はい

ユーザーが所属しているグループのリスト。各グループは以下のフォーマットで書かれます:

  • id — グループID
  • name — グループ名
  • is_default — グループがデフォルトであるかどうかを示します(trueまたはfalseの値)。

デフォルトグループは1つしか存在できません。このグループには、異なるグループに分散される前のすべてのユーザーが初期状態で含まれています。

xsolla_login_project_id 文字列(UUID) はい ログインプロジェクトID。
type 文字列

認証オプション:

  • xsolla_login — ユーザー名/メールアドレスとパスワードによるログイン。
  • social — ソーシャルログイン
  • email — 電子メールで受信したワンタイムコードによるパスワードレスログイン。
  • phone — SMS経由で受信したワンタイムコードによるパスワードレスログイン。
  • firebase — ユーザーデータストレージがFirebaseの場合、ユーザー名/メールアドレスとパスワードでログインします。
  • playfab — ユーザーデータストレージが PlayFabの場合、ユーザー名/メールアドレスとパスワードでログインします。
  • proxy — ユーザーデータストレージがproxyの場合、ユーザー名/メールアドレスとパスワードでログインします。
  • device — デバイスIDでログインします。
  • server_custom_id — カスタムIDを使用してログインします。

デフォルトグループは1つしか存在できません。このグループには、異なるグループに分散される前のすべてのユーザーが初期状態で含まれています。

avatar 文字列 ユーザーのアバターURL。
username 文字列 ユーザー名。
publisher_id integer ログインプロジェクトを所有するマーチャントのID。
email 文字列 ユーザーのメールアドレス。
payload 文字列 認証時にペイロードパラメータで渡される追加情報。
promo_email_agreement ブール型

次のいずれかの値になります:

  • true ユーザーがニュースレターの受信に同意した場合。
  • false それ以外の場合。
デフォルトはtrueの値になります。

ログインウィジェットの登録フォームに機能を追加するには:

  • Widget 2.0を使用している場合は、アカウントマネージャーまでお問い合わせください。
  • 旧バージョンのウィジェットを使用する場合は、初期化コードpromo_email_agreement値を持つfieldsパラメータを追加してください。

connection_information 文字列 ユーザーが生年月日を確認したかどうかを表示します。確認はoknameサービスを通じて行われます。

PlayFabストレージ

PlayFabストレージを使用する場合、認証後にトークンに含まれる要求。

クレーム タイプ 必須 説明
external_account_id 文字列 はい ユーザーPlayFab ID。
session_ticket 文字列 はい

PlayFab APIへの認証リクエストまたはリクエストの間に受け取ったSessionTicketパラメータです。

OAuth 2.0プロトコルを経由でユーザーを認証し、playfab値をscopeパラメータに渡す場合、トークンには要求が含まれます。

entity_token 文字列 はい EntityToken.EntityTokenパラメータ。
entity_type 文字列 はい EntityToken.Entity.Typeパラメータ。 title_player_accountの値のみを持つことができます。
entity_id 文字列 はい EntityToken.Entity.Idパラメータ。

カスタムストレージ

カスタムストレージを使用する場合、認証後にトークンに含まれる要求。

クレーム タイプ 必須 説明
provider 文字列 はい 認証に使用されるソーシャルネットワークの名前。ユーザーがユーザー名とパスワード経由で認証する場合、要求にはxsolla値が含まれます。
external_account_id 文字列 サーバー側のユーザーID。
partner_data Data of any type returned by your server in the response body during authentication. To enable the transmission of this claim, contact your Customer Success Manager or email to csm@xsolla.com
social_access_token Access token of the social network through which the user was authenticated. To enable the transmission of this claim, contact your Customer Success Manager or email to csm@xsolla.com.

ソーシャル認証

ソーシャルネットワーク経由の認証後、トークンに含まれる要求。これらの要求の存在は、ユーザーデータベースに依存しません。

クレーム タイプ 必須 説明
provider 文字列 はい 認証に使用されるソーシャルネットワークの名前。
id 文字列 はい ソーシャルネットワークにおけるユーザーID。
is_cross_auth ブール型 サイレント認証のリクエストが進行中であることを示します。
social_access_token 文字列 認証に使用するソーシャルネットワークアカウントのaccess_tokenパラメータ。この機能をセットアップするには、アカウントマネージャーにお問い合わせください。
picture 文字列(URL) ソーシャルネットワークにおけるユーザープロフィール画像へのリンク。
birthday 日付(RFC3339 ソーシャルネットワークにおけるユーザーの誕生日。
gender 文字列 ソーシャルネットワークにおけるユーザー性別。
name 文字列 ソーシャルネットワークにおけるユーザーニックネーム。

OAuth2.0プロトコル経由の認証

OAuth 2.0認証後のトークンに含まれる要求。

クレーム タイプ 必須 説明
jti 文字列 はい 一意のトークンID。

電話番号経由の認証

電話番号経由の認証後、トークンに含まれる要求。

クレーム タイプ 必須 説明
phone_number 文字列 はい 認証に使用されるユーザーの電話番号。電話番号は、国番号、市外局番、回線番号からなる区切りのない形式です。

サーバーJWT

サーバートークンは、X-SERVER-AUTHORIZATIONヘッダーで渡されます。

トークンのペイロードには、OAuth 2.0クライアントが所有するリソースに関する情報が含まれています。トークンは、これらのリソースに対するサーバーベースの認証によるコールにアクセスできます。

クレーム タイプ 必須 説明
xsolla_login_project_id 文字列(UUID) はい OAuth 2.0クライアントを所有するログインプロジェクトのID。
resources 配列 はい

OAuth 2.0クライアントが所有するリソースのリスト。可能なリソースのタイプ:

  • publisher_id — ログインプロジェクトを所有するマーチャントのリソース
  • publisher_project_idアドミンページでのプロジェクトのリソース。

各グループは以下のフォーマットで書かれます:

  • name — リソースタイプ
  • value — リソースID

jti 文字列 はい 一意のトークンID。

JWT検証

To validate the JWT, use the following Login API calls:

通知

秘密鍵は他人に教えないでください。漏洩した場合は、更新してください。

エラー

Refer to the documentation for information about Xsolla Login API errors.