Entitlement Check for Oculus Store Apps

Note: You are viewing the Native version of this topic. To view this topic for Unity development, see Entitlement Check for Oculus Store Apps (Unity). To view this topic for Unreal development, see Entitlement Check for Oculus Store Apps (Unreal).

One of the requirements to sell an app in the Oculus Store is that you verify the user purchased or obtained your app legitimately. This check is called the entitlement check. You should make the entitlement check within 10 seconds of the user launching your app.

The entitlement check does not require the user to be connected to the Internet. Also, you must handle a failed entitlement check in your app code. A failed entitlement check won’t result in any action on its own. For example, if the check fails, you could show the user an error message and quit the app.

Optionally, you can associate an app entitlement with a Custom Item, which the user can display in their Oculus Home as a reward to customers to purchase your app in the Oculus Store.

Initialize the Platform and Perform the Entitlement Check

Before you perform the entitlement check, you must initialize the platform.

There are two initialization functions you can call with your App ID. One is synchronous and runs on the thread you initialize on, the other is asynchronous and allows you to perform other functions, including calls to the Platform SDK, while the SDK is initializing. We recommend using the asynchronous method for better app performance and less state management, especially for Android apps.

PlatformSynchronous MethodAsynchronous Method
Native Riftovr_PlatformInitializeWindows()ovr_PlatformInitializeWindowsAsynchronous()

The following example code shows:

  • A synchronous initialization call for a Rift app
  • A second call to ovr_Entitlement_GetIsViewerEntitled(). This call checks the user entitlement and verifies that the user owns your app.

Both steps are required to successfully initialize the SDK. The entitlement check should be made within 10 seconds of the user launching the app.

// Initialization call
#define OCULUS_APP_ID "some-app-id"

// Initialization call
if (ovr_PlatformInitializeWindows(OCULUS_APP_ID) != ovrPlatformInitialize_Success)
    // Exit.  Initialization failed which means either the oculus service
    // isn’t on the computer or the DLL is not valid.

When the SDK has finished initializing, a ovrMessage_PlatformInitializeWindows message will be sent to the queue.

PlatformSynchronous MethodAsynchronous Method
Native Androidovr_PlatformInitializeAndroid()ovr_PlatformInitializeAndroidAsynchronous()

The example below shows the asynchronous initialization call for an Android game. When using the asynchronous call, the SDK is placed in an intermediate initializing state before full initialization. In this initializing state you’re able to run other processes, including making calls to asynchronous Platform SDK methods. Requests made to the Platform SDK in the initializing state will be queued and run after the SDK finishes initializing.

The second call in the example below is the entitlement check that verifies that the user owns your app.

// Initialization call

#define OCULUS_APP_ID "some-app-id"
if (ovr_PlatformInitializeAndroidAsynchronous(OCULUS_APP_ID) != ovrPlatformInitialize_Success)
      // Exit.  Initialization failed which means either the oculus service isn’t
      // on the machine or they’ve hacked their DLL

When the SDK has finished initializing, a ovrMessage_PlatformInitializeAndroidAsynchronous message will be sent to the queue.

After initializing the SDK with either initialization method and making the entitlement check, you’ll need to check the response of the entitlement check and handle the result. The following example immediately quits the application if the user is not entitled to your app. You may wish to handle the situation more gracefully by showing the user a message stating that you were unable to verify their credentials, suggest that they check their Internet connection, then quit the app.

// Poll for a response
while ((message = ovr_PopMessage()) != nullptr)
    switch (ovr_Message_GetType(message))
        case ovrMessage_Entitlement_GetIsViewerEntitled:
          if (!ovr_Message_IsError(message))
                // User is entitled.  Continue with normal game behavior
                // User is NOT entitled.  Exit

See the Requests and Messages for information on how native apps interact with the Platform SDK.

You can perform additional user verification if you want to verify the identity of the user to your back-end server. User Verification provides a cryptographic nonce you can pass to verify that the user’s identity. This method does not replace the entitlement check. For more information on how to verify the user, see User Verification.

Test Entitlement Check on Oculus Devices

Test your entitlement check to ensure that your application is up to VRC standards for uploading to the Oculus Store.

Enable Developer Mode

This only needs to be done once per device.

To set up an Oculus Rift for development, see the Rift Native SDK documentation.

  1. Turn on your Oculus Quest device and open the Oculus application on your phone.

  2. Tap Settings in the lower right corner.

  3. Select device, and allow your Oculus application to connect to your device.

  4. Tap More Settings > Developer Mode and then toggle Developer Mode ON.

  5. Restart your Oculus Quest device.

You may need to restart your headset after doing these steps. Once done, there will be a new option in your headset library called “Unknown Sources”.

Test Entitlement Check

Have the application installed and make sure it opens properly before checking entitlements.

  1. Go to the Getting Started API page for your application in the Developer Dashboard.

  2. Replace your App ID with a random string of numbers.

  3. Try launching the app.

  4. The entitlement check should fail, and show an error message to the end user or enter a limited demo mode.

Or, you can log out of the entitled Oculus account and attempt to launch the application.