Documentation

LoginWithXbox

Signs the user in using a Xbox Live Token from an external server backend, returning a session identifier that can subsequently be used for API calls which require an authenticated user

Request Details

If this is the first time a user has signed in with the Xbox Live account and CreateAccount is set to true, a new PlayFab account will be created and linked to the Xbox Live account. In this case, no email or username will be associated with the PlayFab account. Otherwise, if no PlayFab account is linked to the Xbox Live account, an error indicating this will be returned, so that the title can guide the user through creation of a PlayFab account.

LoginWithXboxRequest
Request Properties
CreateAccount Boolean

Automatically create a PlayFab account if one is not currently linked to this ID.

InfoRequestParameters GetPlayerCombinedInfoRequestParams

Flags for which pieces of info to return for the user.

XboxToken (required) String

Token provided by the Xbox Live SDK/XDK method GetTokenAndSignatureAsync("POST", "https://playfabapi.com", "").

POST https://{{TitleID}}.playfabapi.com/Server/LoginWithXbox
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "XboxToken": "XBL3.0 x=1981989841;akljdlkafdknad",
  "CreateAccount": false
}
        

Response Details

ServerLoginResult
Result Properties
EntityToken EntityTokenResponse

If LoginTitlePlayerAccountEntity flag is set on the login request the title_player_account will also be logged in and returned.

InfoResultPayload GetPlayerCombinedInfoResultPayload

Results for requested info.

LastLoginTime DateTime

The time of this user's previous login. If there was no previous login, then it's DateTime.MinValue

NewlyCreated (required) Boolean

True if the account was newly created on this login.

PlayFabId String

Player's unique PlayFabId.

SessionTicket String

Unique token authorizing the user and game at the server level, for the current session.

SettingsForUser UserSettings

Settings specific to this user.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8


Authentication

SecretKey

Possible Error Codes

Name Code
AccountNotFound 1001
ExpiredXboxLiveToken 1189
InvalidPublisherId 1126
InvalidTitleId 1004
InvalidXboxLiveToken 1188
RequestViewConstraintParamsNotAllowed 1303
XboxInaccessible 1339
XboxRejectedXSTSExchangeRequest 1343
XboxXASSExchangeFailure 1306