MoralisWeb3/unity-web3-game-kit

User.SignUpAsync() doesn't signup

ammarvohra opened this issue · 7 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();

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.

Internal Backlog item #69 created for this issue.

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

I'll give it a try

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/io.moralis.web3-unity-sdk@1.2.2/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);
}

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

stale commented

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.