Skip to main content

SuperAuth (< 2.0.0)

caution

SuperAuth is no longer needed since version 2.0.0. If you are using an older version, we highly suggest you to update since this will be deprecated in the future.

info

Only available from version v1.2.0 onwards.

In order to get your project running you will need to setup your developer credentials. These are not the user/password that you use in our website, but a custom API credentials we provide.

You don't have the API credentials?

If you want to get access to our API for your platform/game send us a message at: techsupport@unionavatars.com

Setting the SuperAuth token for developmentโ€‹

While your are working in your project you can setup the credentials inside the Union Avatars window. They are located in the Top Bar -> Union Avatars -> Project Setup -> Settings

Untitled

This will automatically setup your platform credentials in the SDK so you don't have to worry about them

But keep in mind!

This is only for development. When you are ready to launch your product, you will need to integrate them in your game. See below

Developer credentials in productionโ€‹

Do not include the credentials in the client build

Doing this is a major risk and can expose your credentials to everyone

The approach to provide the SuperAuth token to your client build can vary from each project, but here's the basics:

Getting the SuperAuth tokenโ€‹

The first thing you will need is to get the SuperAuthorization token from your API credentials. If you are using a Unity build as a server (Mirror, Photon, etc,...), you can use the LoginSuper method inside your Session instance.

async void SuperAuthServerExample() { // Create a new session ServerSession session = new ServerSession(); // Login with your API Credentials AuthToken superAuthToken = await session.LoginSuper("USERNAME", "PASSWORD"); }
async void SuperAuthServerExample() { // Create a new session ServerSession session = new ServerSession(); // Login with your API Credentials AuthToken superAuthToken = await session.LoginSuper("USERNAME", "PASSWORD"); }

If your server is not a unity build you will need to implement this API call by yourself. Please take a look at our API docs: https://endapi.unionavatars.com/docs

Sending the SuperAuth token to your clientsโ€‹

Once you get your SuperAuth token you will send it to each client that requests it. Then each client must add the received SuperAuth token into it's session.

async void SuperAuthClientExample() { // Create a new session ServerSession session = new ServerSession(); AuthToken serverSuperAuthToken; // ... // Your network code here to get the token from the server // ... // Set the SuperAuthorization token session.SessionContext.SetSuperAuthToken(serverSuperAuthToken); }
async void SuperAuthClientExample() { // Create a new session ServerSession session = new ServerSession(); AuthToken serverSuperAuthToken; // ... // Your network code here to get the token from the server // ... // Set the SuperAuthorization token session.SessionContext.SetSuperAuthToken(serverSuperAuthToken); }

It's done! Now every call performed with you ServerSession will be using your SuperAuth token.

Caution

However, please be aware that the SuperAuth token has an expiration date of one week since it's creation. If you are working in a multiplayer game you will need to keep you clients updated by letting them know the most up to date version of your token.