Token Authorization (OAuth)

Strix Cloud can be configured to use OAuth so that connections can be authorized by your own methods for the purposes of player account control.

See the OAuth RFC for more info on how OAuth works.

Enabling Authorization

You can enable OAuth by checking the Authorization enabled box and specifying your User Resource Url, User ID key, and Name key under the Options tab of your application page on the Strix Cloud web console.

Authorization enabled and related settings

Using Authorization

If OAuth is enabled for the application, a client requires the authorization access token be set to StrixNetwork singleton as follows:

StrixNetwork.instance.authorizationAccessToken = myToken;

This requires the client to receive the token from your authorization provider after login. Strix servers will retrieve the resource server information from the settings you have specified on the Strix Cloud web console and request a resource from the resource server.

The response from your resource server should be a JSON as follows:

{
    "name" : "logged in user name",
    "userId" : 1
}

If the server receives an http OK response with an appropriate JSON object, it will then set the current Room Member name property and an additional userId custom property to the values in the response. These values cannot be overwritten while the network is initialized. These represent the name and ID of the user with the http access token.

If it receives an http error response, connections to room servers will fail. The network should be stopped and started again, and the connection should be retried.

Note

With the server-side settings User ID key and Name key, you can configure the actual names of the particular JSON keys (“name” and “userId” in the example above) to match with your authorization server.