Account Linking

Link Ready Player Me accounts to your user profiles.

Account Linking allows end-users to link their Ready Player Me account to your app/game account, so they won't have to log in again when they return to your app. This is particularly useful for cross-device experiences when session information is lost.

Prerequisites

  • Server Component The endpoints should be called from a server to keep your API Key secure. So we recommend you set up a server component and have all account linking logic connected to your user management in the backend.

  • Get your API Key

    This can be found within Ready Player Me Studio on the left-hand navigation panel or directly here. You will need the API Key for all API-Requests. See authorizing requests.

Authorization for existing Ready Player Me users

Users with a Ready Player Me account can authorize your application to create/modify avatars by entering their credentials in the Avatar Creator. They do that by clicking the sign-in with Ready Player Me button within the iFrame.

Once the user authorizes, you will be returned it’s User-ID from the iFrame. Therefore you need to subscribe to the postMessage event v1.user.authorized from the iFrame

Read more on postMessage events

You will need the User ID to login on behalf of your user with an API request. (See next chapter)

Login on behalf of a user and request a token.

After getting authorized by the end-user and having his/her userId, you can request an access token for this user, which you can use to open the Avatar Creator in the iFrame or WebView.

  1. Get Tooken

GET https://api.readyplayer.me/v1/auth/token

Get a shortlived token (15s) to authenticate the WebView/iFrame

Query Parameters

NameTypeDescription

userId*

String

UserID of your user

partner*

String

Your subdomain

Headers

NameTypeDescription

x-api-key*

String

Your API Key

Sample Response:
{
	"data": {
		"token": “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...”
	}
}
  1. Add the token from the to the main ReadyPlayerMe URL you use in the iframe or WebView.

iframe.src = 'https://{your-subdomain}.readyplayer.me/avatar?frameApi&token={token}'

The user should be logged in and have access to his/her avatars within the iFrame.

The token lives for 15 seconds, so you must request it right before using it.

Last updated