Forum Discussion
Taivas
3 years agoProtege
Hello! I'm having trouble with user identification.
Authentification request sends Oculus User ID: 0 even though all permissions are valid in developer dashbpard. My code:
using Oculus.Platform;
using Oculus.Platform.Models;
using UnityEngine;
public class UserIdentification : MonoBehaviour
{
private void Awake()
{
Oculus.Platform.Core.AsyncInitialize("227131****73792");
}
private void OnOculusPlatformInitialized(Message<string> message)
{
if (message.IsError)
{
Debug.LogError("Oculus Platform initialization failed: " + message.GetError().Message);
}
else
{
Debug.Log("Oculus Platform initialized successfully.");
// You can now safely use Oculus Platform functions here.
}
}
private void Start()
{
// Call the method to get the user information
GetUserName();
}
private void GetUserName()
{
// Request the currently logged-in user's information
Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
}
private void GetLoggedInUserCallback(Message<User> message)
{
if (!message.IsError)
{
// Retrieve user information
User user = message.Data;
string userName = user.ID.ToString(); // Oculus User ID
string displayName = user.DisplayName;
// Display the user information
Debug.Log("Oculus User ID: " + userName);
Debug.Log("Display Name: " + displayName);
}
else
{
Debug.LogError("Error getting user information: " + message.GetError().Message);
}
}
}
1 Reply
- jtriveriStart Partner
We’re seeing similar behavior. Can’t say for sure but I think v59 may have changed something.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 5 months ago
- 2 years ago
- 4 months ago