Documentation

GetEntityToken

Method to exchange a legacy AuthenticationTicket or title SecretKey for an Entity Token or to refresh a still valid Entity Token.

Request Details

This API must be called with X-SecretKey, X-Authentication or X-EntityToken headers. An optional EntityKey may be included to attempt to set the resulting EntityToken to a specific entity, however the entity must be a relation of the caller, such as the master_player_account of a character. If sending X-EntityToken the account will be marked as freshly logged in and will issue a new token. If using X-Authentication or X-EntityToken the header must still be valid and cannot be expired or revoked.

GetEntityTokenRequest
Request Properties
Entity EntityKey

The entity to perform this action on.

POST https://{{TitleID}}.playfabapi.com/Authentication/GetEntityToken
    Content-Type: application/json
{}
        

Response Details

GetEntityTokenResponse
Result Properties
Entity EntityKey

The entity id and type.

EntityToken String

The token used to set X-EntityToken for all entity based API calls.

TokenExpiration DateTime

The time the token will expire, if it is an expiring token, in UTC.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "EntityToken": "lS2hbYH1Gls1KbnlyozHSQBrF4zsq6q006ci9ijSNqQUiiO6xyCQtVrLjsXjdBJ",
    "Entity": {
      "Id": "174812abf712",
      "Type": "title_player_account",
      "TypeString": "title_player_account"
    }
  }
}

Authentication

None

Possible Error Codes

Name Code
EntityTokenExpired 1336
EntityTokenInvalid 1335
EntityTokenRevoked 1337
NotAuthenticated 1074