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

Use the following VIVEPORT SDK API to complete the integration flow:

Top Level API

int Init(StatusCallback callback, string viveportId);
Name Type Description
callback StatusCallback Callback function
viveportId string Entity’s VIVEPORT ID
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. The token is necessary for the Photon integration API.

Error code

  • It is recommended to follow the troubleshooting procedures below first if you receive an error code like the following.
Error Code Description & Trouble Shooting
0 Success
50001 Invalid account ID/VIVEPORT ID/VIVEPORT key
50004 Cannot connect to the server
80002 User is not logged in to VIVEPORT account

How to receive a secret key

  • The secret key is used in photon authentication page.
  • Request the secret key by emailing store@viveport.com or going here: VIVE Developers. The VIVEPORT operation team will process 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

  • Get a VIVEPORT ID and VIVEPORT Key from the VIVEPORT Developer Console, and then paste them to your content. Please refer to here for more information.
  • Use Top Level API - Viveport.Api.Init to initialize the VIVEPORT SDK service. For Unity developers, the Top Level API is usually used in MonoBehaviour “Start()”.
  • Use DRM API - Viveport.Api.GetLicense to verify if the current user is allowed to launch the content. It is usually used in where to check the user’s authentication. If you receive an error code from the DRM API, show an error message to the user and then close the content.
  • 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 an authorized user’s information on a local operating system or within an authentication server.
  • Use Top Level API - Viveport.Api.Shutdown to shut down and release VIVEPORT SDK resources. For Unity developers, the Top Level API is usually used in MonoBehaviour “OnDestroy()” or before Application.Quit().

For integration with Photon, except for receiving an user token from the aforementioned VIVEPORT Session Token API, you still need to reqeust a secret key and put it on photon authentication page.

Before testing

  • Go to the VIVEPORT website and download the 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 with your developer account.

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

Important

You can also refer to the Error Codes and Troubleshooting pages to learn 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 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. By clicking “HTC VIVE”, 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