Demo: Custom Token
This demo is integrated after Unity SDK v2.1.8. If you want to experience this demo, please update to a version of the SDK after 2.1.8.
This demo will demonstrate logging in with a Custom Token. Currently, we are using API Key and Secret stored locally by default, but this is generally not secure. We recommend that users use the Inworld Web SDK to establish an authorization server, store the corresponding API Key and Secret data on the server, and then issue valid Access Tokens to clients based on the client's identity. Clients can then carry this Access Token to request connection and start a session with the Inworld server.
1. Disclaimer
⚠️ Note: This demo will log in through the copy-paste token method. Note that this method is not secure either, and we recommend using more secure authorization mechanisms such as OAuth in actual applications. In Unity, you can directly send a
UnityWebRequest
to the Auth Server to obtain a JSON-formatted token, and then use it to call the API to log in to the Inworld server and establish a session.
2. Opening the sample scene
In the Project Panel, click Inworld
> Inworld.Samples.RPM
> Scenes
> SampleCustomToken
to open the demo scene.
In this demo, the AutoStart is set to false. You will need to paste the token to manually establish the connection.
3. Start generate token server
Follow this instruction to start an authorization server.
After server started, the IP address is by default 127.0.0.1:4000
4. Login Inworld by custom token
Then you can paste token to login.