Iām getting a Validation failed. Please login to continue.
error on my console, which might mean the user is not logged in, but in another part of the app Moralis detects that the user is logged in and hence doesnāt show the authenticate button.
Exact error:
ERROR || 2022-01-11 12:03:27
Parse error: Validation failed. Please login to continue.
Failed running cloud function putWalletWasActiveInInterval for user undefined with:
Input: {"signal":true}
Error: {"message":"Validation failed. Please login to continue.","code":142}
The code that checks for the user being logged in looks like:
await MoralisInterface.Initialize(moralisAppId, moralisServerUri, new HostManifestData
{
Identifier = appName,
Name = appName,
ShortVersion = buildVersion,
Version = buildVersion
});
if (MoralisInterface.IsLoggedIn())
{
Debug.Log(UserIsAlreadyLoggedInToMoralis);
}
else
{
authPanel.gameObject.SetActive(true);
}
In the internals, this is what the current GetCurrentUser
logic says:
public static MoralisUser GetCurrentUser<TUser>(this IServiceHub<TUser> serviceHub) where TUser : MoralisUser
{
Task<TUser> userTask = GetCurrentUserAsync(serviceHub);
// TODO (hallucinogen): this will without a doubt fail in Unity. How should we fix it?
userTask.Wait();
return userTask.Result;
}
Shouldnāt this be an async
call?
Maybe this is the workaround. How will I find user.sessionToken
?