Desktop Launcher Connect
Consult with the Treasure team to gain access to a pre-release version of the Treasure Launcher.
Games that are distributed via the Treasure Launcher, do not need to authenticate users via the Treasure Connect flow.
The React TDK will automatically detect if the user is using the Treasure Launcher and will use the Treasure Launcher’s authenticated account automatically.
Usage
Start a user session
To start a user session via the Treasure Launcher, use the startUserSession
function from the useTreasure
hook:
Check if using Treasure Launcher
If your game is distributed via the Treasure Launcher, this will automatically call the startUserSessionViaLauncher
from the @treasure-dev/launcher
package.
Manual Installation
While Desktop Launcher Connect usage with the React TDK is built-in you can still install the @treasure-dev/launcher
package for manual usage.
You can use the functionality of the package to interact with the Treasure Launcher as described in the TDK Core documentation.
This is important if you are using the React TDK in some non-standard way, such as in an Electron application where the renderer process cannot access the process directly.
Electron Usage
If your game is built with Electron, the TDK will not be able to automatically read the auth token due to security restrictions.
You will need to manually read the auth token from the getTreasureLauncherAuthToken
function from the @treasure-dev/launcher
package and pass the result to the TDK.
In your main process, you can listen for the get-auth-token
event and return the auth token:
And in your renderer process, you can define a getAuthToken
function using the ipcRenderer
API and passing that to launcherOptions
in the TreasureProvider
: