Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
axl's avatar
axl
Explorer
9 years ago

IOnlineIdentity::GetAccessToken(int32 LocalUserNum)

Is there a plan for implementing the above function? (It currently returns an empty string) I'm assuming that it should wrap ovr_UserProof_Generate() and related functions, and I need the nonce for backend validation. I would prefer not to have to work around the OSS.

5 Replies

Replies have been turned off for this discussion
  • brian_jew's avatar
    brian_jew
    Expert Protege
    Hi Axl,  we currently have this as low pri on our tasks.  You do bring up a good point that this will be useful to do backend validation.  It looks like two things needs to be exposed, the accesstoken and the userproof.  It might be implemented as IOnlineIdentity::GetAuthToken() will do the userproof and FUserOnlineAccount::GetAccessToken() for access token.  We can look into getting this into our Platform SDK 1.11
  • I had another look at the code today, and IOnlineIdentity::GetAuthToken() is flagged for removal and one should use FUserOnlineAccount::GetAccessToken() instead, so relying on both may get you into trouble down the line.

    Considering that those functions are both expected to be non-blocking and that ovr_UserProof_Generate() relies on the message queue being processed, perhaps the API will have to be redesigned by Epic anyway.
  • brian_jew's avatar
    brian_jew
    Expert Protege

    axl said:

    I had another look at the code today, and IOnlineIdentity::GetAuthToken() is flagged for removal and one should use FUserOnlineAccount::GetAccessToken() instead, so relying on both may get you into trouble down the line.

    Considering that those functions are both expected to be non-blocking and that ovr_UserProof_Generate() relies on the message queue being processed, perhaps the API will have to be redesigned by Epic anyway.


    Thanks for pointing that out.  I looked into if there's a way to help get you going without being blocked by a redesign by Epic.  I landed a change that should go out for the Oculus OSS 1.10 that'll let you use the ovr_* calls with the Oculus OSS directly for anything that isn't covered by the OSS Interface.  This should let you do anything in the LibOVRPlatform that isn't quite covered by the OSS Interface:

    // example: getting the access token

    In the Build.cs:

    PrivateDependencyModuleNames.Add("OnlineSubsystemOculus");
    PrivateDependencyModuleNames.Add("LibOVRPlatform");

    // In your *.cpp

    #include "OnlineSubsystemOculus.h"
    #include "OVR_Platform.h"

    ...

    ovrRequest RequestId = ovr_User_GetAccessToken();
    FOnlineSubsystemOculus* OSS = static_cast<FOnlineSubsystemOculus*>(IOnlineSubsystem::Get());
    OSS->AddRequestDelegate(RequestId, FOculusMessageOnCompleteDelegate::CreateLambda([this](ovrMessageHandle Message, bool bIsError)
    {
      auto AccessToken = FString(ovr_Message_GetString(Message))
    }));

    The same can be done to get the UserProof.  This should get you the best of both worlds: letting you use the OSS wrappers where it is covered and not having to work completely around the OSS when using calls that aren't covered by the OSS yet in version 1.10+.
  • Excellent! I'm already using a small wrapper for the OSS to get some custom features abstracted and this would fit right in there.

    Cheers!