Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
RaptorMatt's avatar
RaptorMatt
Expert Protege
4 years ago
Solved

Can't Get User Name (App Lab)

I am developing an Oculus Quest app for release on the App Lab. Previously, I was able to get the player's user name just fine via

 

Oculus.Platform.Users.GetLoggedInUser().OnComplete(getLoggedInUserComplete);

 

but recently that stopped working and now the user name is just an empty/null string. Essentially, I can't display a user name above players' heads anymore.

 

Below is the code I am using to retrieve the user name:

 

void getLoggedInUserComplete(Message msg)
        {
            if (msg.IsError)
            {
                Debug.LogError("Could not get Oculus user name!");
            }
            else
            {
                Debug.Log("GetLoggedInUser success! " + msg + "; message type: " + msg.Type);
                if (msg.Type == Message.MessageType.User_GetLoggedInUser)
                {
                    Debug.Log("Oculus GetLoggedInUser success! Setting user name in game manager: " + msg.GetUser().OculusID);
                    GameManager.Instance.SetUserName(msg.GetUser().OculusID);

                    Debug.Log(msg.GetUser().DisplayName);
                    Debug.Log(msg.GetUser().ID);
                    Debug.Log(msg.GetUser().OculusID);
                    Debug.Log(msg.GetUser().ToString());
               

 

 

GetLoggedInUser is successful, however the message that gets returned is empty. Here is what prints out into the debug log from the above code:

 

Oculus Platform entitlement check passed!
GetLoggedInUser success! Oculus.Platform.MessageWithUser: message type: User_GetLoggedInUser
Oculus GetLoggedInUser success! Setting user name in game manager: 

0

Oculus.Platform.Models.User

 

 

As you can see, all of the information returned in the GetLoggedInUser message is empty. My app key is correct, the entitlement check passes, and it successfully gets the logged in user but with an empty return message. It did not used to be this way but recently it broke (without me changing any of the code). I'm stumped. How can this be fixed?

7 Replies

  • RaptorMatt's avatar
    RaptorMatt
    Expert Protege

    My issue was fixed by filling out and submitting the "Data Use Checkup" in the developer dashboard. The approval for this was instant - there doesn't seem to be an actual review process. I also requested access to every API feature in the list.

     

    After doing so, the API features in my app began working again. I don't know why they worked before if this was a required step. Perhaps Oculus made a change, but didn't tell anyone.

     

    I found the original answer to the problem here: https://forums.oculusvr.com/t5/Unreal-Development/Get-Oculus-Identity-returns-No-Logged-In-user/m-p/853430#M6278

    • KrzysztofWrona's avatar
      KrzysztofWrona
      Member

      Hm, I have the same issue, but for me the data-use checkup seems to be taking a long time, I am already waiting for 3 weeks and it still says it is "in review" - is anybody having the same issue with the data checkup?

      • adamofeden's avatar
        adamofeden
        Explorer

        Were you ever approved?  I am having the same issue.

         

    • yangyucaid's avatar
      yangyucaid
      Honored Guest

      It works for me after DUC. One more thing, even for test user, if we don't enable data use with DUC, we still can't get the user name after deploying into Quest device. Although the user name can be retrieved in Unity editor, and also the official Oculus document says that "Test user accounts are exempt from DUC requirements. When you use test users to make API calls to Oculus Platform features, the features return valid data even if your app has not been approved for those features.https://developer.oculus.com/resources/publish-data-use/#how-to-develop-apps-while-waiting-for-duc-approvals 

      The codes for retriving user name in both Quest2 device and Unity Editor:

       

          private void OnLoggedInUserCallback(Message<User> msg)
          {
              if (msg.IsError)
              {
                  Debug.LogErrorFormat("Oculus: Error getting logged in user. Error Message: {0}",
                      msg.GetError().Message);
              }
              else
              {
                  oculusId = msg.Data.ID.ToString(); // do not use msg.Data.OculusID;
                  oculusDisplayName = string.IsNullOrEmpty(msg.Data.DisplayName) ? msg.Data.OculusID  : msg.Data.DisplayName; // oculus user display name
                  
                  GetUserProof();
              }
          }

       

    • altreality.2023's avatar
      altreality.2023
      Honored Guest

      I have filled Data use checkup form and got approved too, got all the features active but still I am not getting the username and Id, can you please help me with this. I have attached the image of my approved permissions

       

  • Do I have to fill in this Data Use Checkup also for a simple test application that I just build and run from Unity?

     

    Is there some documentation on this? When I test this in the editor I get a nullpointer exception on Oculus.Platform.Users.GetLoggedInUser().OnComplete(getLoggedInUserComplete);

    And when I do build and run I get the same error in Android Logcat.

     

    The Unity reference documentation (https://developer.oculus.com/reference/unity/latest/ ) no longer exists. And from the textual explanation (https://developer.oculus.com/documentation/unity/ps-presence/ ) I expected that Platform.Users.GetLoggedInUser() would simply return a User object, not that I had to use a callback and check a message.

     

    I hope someone can point me in the right direction.