unity-web3-game-kit icon indicating copy to clipboard operation
unity-web3-game-kit copied to clipboard

User.SignUpAsync() doesn't signup

Open ammarvohra opened this issue 2 years ago • 6 comments

As stated in the issue #77 if I need to create new user with just Username/email and password I am not able to create it, and I cannot see the user in database.

MoralisUser user = new MoralisUser();
user.username = "email";
user.email = "email";
user.password = "password";
await user.SignUpAsync();

ammarvohra avatar May 17 '22 10:05 ammarvohra

Admittedly this is a little clumsy. Currently the best way to create a new user object is: MoralisUser user = MoralisInterface.Create<MoralisUser>(); What this does is to setup the underlying MoralisObject properly. new MoralisUser() returns a user object but it is not set up into interact properly.

Will open a backlog item to address this process.

xactant avatar May 18 '22 11:05 xactant

Internal Backlog item #69 created for this issue.

xactant avatar May 18 '22 11:05 xactant

Just wanted to note that Signup also does not currently set current User as described in #95.

Current: Signup is called and return User object from DB, DB shows same User. But GetUserAsync() is null as well as other GetUser()/GetClient().GetCurrentUser() methods.

Expected: Signup is called and MoralisInterface.GetUserAsync() can be called right after or later on to get the same user.

Excited for next release :D

Denchyaknow avatar May 19 '22 19:05 Denchyaknow

I'll give it a try

ammarvohra avatar May 21 '22 05:05 ammarvohra

While I use this one:

        MoralisUser user = Moralis.Create<MoralisUser>();
        user.email = "username";
        user.username = "username";
        user.password = "Password";
        try
        {
            await user.SignUpAsync();
        }
        catch (Exception error)
        {
            // Show the error message somewhere and let the user try again.
            Debug.LogError("{0} Exception caught: "+error);
        }

It throws exception of

MoralisFailureException: Moralis must be started and user authenticated before accessing this object.
MoralisUnity.Moralis.Create[T] (System.Object[] parameters) (at Library/PackageCache/[email protected]/Runtime/Core/Moralis.cs:487)

But this one works well

try 
{
    // this signs the user up and doesnt log them in
    await Moralis.SignUpAsync("myname", "mypass");
    // Hooray! Let them login the app now.
}
catch (Exception error) 
{
    // Show the error message somewhere and let the user try again.
    Debug.log("{0} Exception caught:", error);
}

ammarvohra avatar Jul 04 '22 07:07 ammarvohra

This issue was fixed during followup code releases. I this still an issue for you?

xactant avatar Aug 25 '22 14:08 xactant

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 24 '22 15:10 stale[bot]