Photon Viveport Authentication

Introduction

  • VIVEPORT and Photon each provide an integration service to implement custom authentication for content developers to have the ability to ensure the users are valid Viveport users for matchmaking. This document mainly focuses on Viveport integration. For more information about Photon, please go here.

Function Spec

In this integration flow, it will be completed by following VIVEPORT SDK API:

Top Level API

int Init(StatusCallback callback, string viveportId);
Name Type Description
callback StatusCallback Callback function
viveportId string Entity’s VIVEPORT ID
Return Type Description
1 int The VIVEPORT ID is vaild
int Shutdown(StatusCallback callback);
Name Type Description
callback StatusCallback Callback function

DRM API

void GetLicense(LicenseChecker callback, string viveportId, string viveportKey);
Name Type Description
callback LicenseChecker Callback function
viveportId string Entity’s VIVEPORT ID
viveportKey string Entity’s VIVEPORT Key

Session Token API

void IsReady(StatusCallback callback);
Name Type Description
callback StatusCallback Callback function
void GetSessionToken(StatusCallback2 callback)
Name Type Description
callback StatusCallback2 Callback function

Details

Through the Session Token API, the authorized user token can be accessed from the callback function. And the token is necessary for the Photon integration API.

Error code

  • It is recommended to follow the trouble shooting first while getting such an error code like following.
Error Code Description & Trouble Shooting
0 Success, no error
50001 Invalid account ID/VIVEPORT ID/VIVEPORT key
50004 Cannot connect to server
80002 GetLicense failed because user does not login VIVEPORT

How to receive a secret key

  • The secret key is used to identify which application is using the authentication service.
  • Request the secret key by emailing store@viveport.com or leave your request here: VIVE Developers. The VIVEPORT operation team will proceses your request and provide the secret key immediately upon receiving the request.
  • Title Name / VIVEPORT ID / ACCOUNT ID are necessary information when requesting the secret key via email or the website.

Best Practice

Attention

  • To get a VIVEPORT ID and VIVEPORT Key from the VIVEPORT Developer Console and paste them to your content. Please refer to here.
  • Use Top Level API - Viveport.Api.Init to initialize VIVEPORT SDK service. For Unity developer, it is usually used in MonoBehaviour “Start()”.
  • Use DRM API - Viveport.Api.GetLicense to verify whether current user is allowed to launch the content. It is usually used in where to check the user’s authentication. Show an error message and close the content if you receive the error code from the API.
  • Use Session Token API - Viveport.Token.IsReady to ensure the connection is successfully established with the VIVEPORT platform.
  • Use Session Token API - Viveport.Token.GetSessionToken to get authorized user’s information on a local operating system or within an authentication server.
  • Use Top Level API - Viveport.Api.Shutdown to shutdown and release VIVEPORT SDK resources. For an Unity developer, it is usually used in MonoBehaviour “OnDestroy()” or before Application.Quit().

For the integration part with Photon, except receiving an user token from the VIVEPORT Session Token API mentioneds above, you still need to use a secret key to be establish a certification between VIVEPORT and the Photon server.

Before testing

  • Go to VIVEPORT website and download VIVEPORT desktop application.

    _images/Viveport_home.png
  • Install the downloaded file ViveportSetup.exe and follow the step by step instructions to complete the setup process.

  • On the PC desktop, a VIVEPORT icon will appear. Double click to launch it and sign in as your developer account.

    _images/viveport_desktop_icon.png
  • Launch your content. Testing can be started.

Important

You can also see the Error Codes and Trouble Shooting pages to know what to do when you encounter problems using the VIVEPORT SDK.

Sample Code

Unity / Unreal

Notes

The following discusses the integration with the Photon developer console and the Photon SDK.

1.How to integrate with Photon Dashboard

  • Create/Sign in to a Photon account on Viveport developer console Settings page.

    _images/photon_login.jpg
  • Go to the “Manage” page in Photon Dashboard of an application and scroll down to the “Authentication” section. With one click, you can add or edit the “HTC Vive” authentication provider. Please put your VIVEPORT ID into appid; and the SECRET KEY into appsecret.

    _images/photon_htcvive.jpg _images/photon_secret.jpg

2.How to integrate with Photon SDK