PlayEveryWare / eos_plugin_for_unity

Repository for PlayEveryWare's EOS Plugin for Unity, bringing the functionality of Epic Online Services to the Unity Game Engine.
https://eospluginforunity.playeveryware.com
288 stars 56 forks source link

StartConnectLoginWithEpicAccount returns InvalidUser (user_not_found, 110016, EOS User Identity not found) on Live for real user (debug user works) #666

Closed BestStream closed 5 months ago

BestStream commented 5 months ago

StartConnectLoginWithEpicAccount returns InvalidUser (user_not_found, 110016, EOS User Identity not found) on Live for real user (debug user works).

Log:

05/13/2024 15:42:05 LogEOSAuth(Verbose): Polling for token grant. Device auth flow to be continued at https://www.epicgames.com/activate?userCode=FHCGDJQX
05/13/2024 15:42:05 LogEOSAnalytics(Verbose): Record Event: EOSSDK.HTTP.Complete <Redacted>
05/13/2024 15:42:05 LogEOSAnalytics(Verbose): Record Event: EOSSDK.Heartbeat <Redacted>
05/13/2024 15:42:15 LogEOSAuth(Verbose): Next token grant poll
05/13/2024 15:42:15 LogEOSAuth(Verbose): FPolledTokenGrantRequestTask Success
05/13/2024 15:42:15 LogEOSAnalytics(Verbose): Record Event: EOSSDK.HTTP.Complete <Redacted>
05/13/2024 15:42:15 LogEOSAuth(Info): UpdateUserAuthToken: User ClientId: xyz...jk2 AccountId: e61...4b8 Access[Expires: 2024.05.13-14.42.15 Remaining: 7200.36] Refresh[Expires: 2024-11-09T12:42:15.362Z Remaining: 15552000.36] State: Valid
05/13/2024 15:42:15 LogEOSAuth(Info): UserAuthGenerated: Received FUserAuthToken
05/13/2024 15:42:15 LogEOSAuth(Verbose): Persistent auth credentials successfully updated in the local keychain.
05/13/2024 15:42:15 LogEOSAnalytics(Verbose): Record Event: EOSSDK.HTTP.Complete <Redacted>
05/13/2024 15:42:15 LogEOSAuth(Info): UserAuthGenerated: Login complete: EOS_Success
2024-05-13T15:42:15.6806850+03:00 [1] Epic - StartLoginWithLoginOptions AccountPortal: Success
UnityEngine.Debug:Log (object)
SG.Log:Info (object) (at Assets/Plugins/SG/Core/Utils/Log.cs:125)
SG.Payments.Epic/<>c__DisplayClass20_0:<Login>b__4 (Epic.OnlineServices.Auth.LoginCallbackInfo) (at Assets/Plugins/SG/Core/Payments/Payment Providers/Epic.cs:124)
PlayEveryWare.EpicOnlineServices.EOSManager/EOSSingleton/<>c__DisplayClass66_0:<StartLoginWithLoginOptions>b__0 (Epic.OnlineServices.Auth.LoginCallbackInfo&) (at ./Library/PackageCache/com.playeveryware.eos@4a1b4c679ee4/Runtime/Core/EOSManager.cs:1414)
Epic.OnlineServices.Auth.AuthInterface:OnLoginCallbackInternalImplementation (Epic.OnlineServices.Auth.LoginCallbackInfoInternal&) (at ./Library/PackageCache/com.playeveryware.eos@4a1b4c679ee4/Runtime/EOS_SDK/Generated/Auth/AuthInterface.cs:508)
Epic.OnlineServices.Platform.PlatformInterface:Tick () (at ./Library/PackageCache/com.playeveryware.eos@4a1b4c679ee4/Runtime/EOS_SDK/Generated/Platform/PlatformInterface.cs:944)
PlayEveryWare.EpicOnlineServices.EOSManager/EOSSingleton:Tick () (at ./Library/PackageCache/com.playeveryware.eos@4a1b4c679ee4/Runtime/Core/EOSManager.cs:1534)
PlayEveryWare.EpicOnlineServices.EOSManager:Update () (at ./Library/PackageCache/com.playeveryware.eos@4a1b4c679ee4/Runtime/Core/EOSManager.cs:1813)
05/13/2024 15:42:15 LogEOSAuth(Info): user already logged in
05/13/2024 15:42:16 LogEOS(Warning): Error response received from backend. ServiceName=[EOSAuth], OperationName=[TokenGrant], Url=[<Redacted>], HttpStatus=[404], ErrorCode=[errors.com.epicgames.eos.auth.user_not_found], NumericErrorCode=[110016], ErrorMessage=[EOS User Identity not found. identityProviderId: epicgames accountId: e61462ff501a4c36bf8bbe1faee744b8], CorrId=[EOS-W3CnQnIdSsmvRLjZaBdRSg-JgDBcQitTOeJyKQXotj1Xw]
secondimpactrob commented 5 months ago

Your log only seems to show Auth calls, nothing to do with Connect?

If the issue you have is like one we saw, we found that brand new epic accounts would have no Product User ID yet, and Connect login calls would returns invalid user. We needed to react to that situation and call Connect CreateUser to make sure that they got their Product User ID that first time, and from there it would work. (The docs are hazy on this and mostly refer to it in terms of non-epic flows, but it appears to be necessary)

BestStream commented 5 months ago

@secondimpactrob Only this log is there. I believe his last line contains useful information: Error response received from backend. ServiceName=[EOSAuth], OperationName=[TokenGrant], Url=[<Redacted>], HttpStatus=[404], ErrorCode=[errors.com.epicgames.eos.auth.user_not_found], NumericErrorCode=[110016], ErrorMessage=[EOS User Identity not found

Immediately after it, StartConnectLoginWithEpicAccount returns InvalidUser.

You right, the error occurs on new accounts. I created a new account on purpose to check if in-game purchases work in Live environment.

So what advice can you give? What can be done to fix this?

secondimpactrob commented 5 months ago

I believe what you need to do is:

Following successful Auth login, do your Connect Login.

In the callback, check the result: -> if SUCCESS, all good -> if INVALID_USER, call EOSManager.Instance.CreateConnectUserWithContinuanceToken passing the continuance token you get in the callback.

This approach can be seen in PEW's sample code (inside UILoginMenu.cs), however in their code they then follow up with another Connect login, which I didn't find to be needed.

BestStream commented 5 months ago

@secondimpactrob Thank you for advice! I tried. But even though the login is successful, LoginCallbackInfo.ContinuanceToken empty and CreateConnectUserWithContinuanceToken returns an error "Invalid parameter EOS_Connect_CreateUserOptions.ContinuanceToken reason: property must not be null"

secondimpactrob commented 5 months ago

@BestStream the continuance token should come from the failed Connect login callback (where it returns invalid user) not the successful Auth login.

BestStream commented 5 months ago

@secondimpactrob Thank you very much! It works now. And this really is in the examples (it's strange that I missed this when I transferred the code from there)