parse-community / Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
http://parseplatform.org
Apache License 2.0
322 stars 260 forks source link

Await _parseClient.GetCurrentUser is null after login #362

Open chamboryk opened 2 years ago

chamboryk commented 2 years ago

New Issue Checklist

Issue Description

After login, the current user is null Unity 2020.3.11

Steps to reproduce

    _parseClient = new ParseClient("myAppId", "http://localhost:1337/parse/", "",
        new LateInitializedMutableServiceHub { },
        new MetadataMutator
        {
            EnvironmentData = new EnvironmentData { OSVersion = SystemInfo.operatingSystem, Platform = $"Unity {Application.unityVersion} on {SystemInfo.operatingSystemFamily}", TimeZone = TimeZoneInfo.Local.StandardName },
            HostManifestData = new HostManifestData { Name = Application.productName, Identifier = Application.productName, ShortVersion = Application.version, Version = Application.version }
        },
        new AbsoluteCacheLocationMutator
        {
            CustomAbsoluteCacheFilePath = $"{Application.persistentDataPath.Replace('/', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}Parse.cache"
        }
    );
    Debug.Log($"{Application.persistentDataPath.Replace('/', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}Parse.cache");
    _parseClient.Publicize();

            var loginResult = await _parseClient.UserController.LogInAsync(SystemInfo.deviceUniqueIdentifier, SystemInfo.deviceUniqueIdentifier, new LateInitializedMutableServiceHub { }); //login result not null
            var currenSession = await _parseClient.GetCurrentSessionAsync(); //currentSession == null
            var currentUser = _parseClient.GetCurrentUser();//currentUser == null

Actual Outcome

var currentUser = _parseClient.GetCurrentUser();//currentUser == null

Expected Outcome

var currentUser = _parseClient.GetCurrentUser();//currentUser != null

Environment

Server

Database

Client

Kellokes commented 2 years ago

Hi all,

Any update on this bug? What is the best way to fix or create a workaround for this? I saw that when I use this cmd _parseClient.GetCurrentUser().SessionToken; I received the Token when the Login is Successful, otherwise I get null, would checking this be a good alternative to proceed with login validation?