The first thing you want a user to do is to sign up. The following code illustrates the sign up process:
You can use
signupWithEmail:password: to sign up users with emails as well:
These two methods will create a new user in your app. Before completing the process, it automatically checks if the username is unique. New users should always be created with either one of the methods.
When a new user is successfully created, a
SKYUser is returned.
If the signup is not successful, you should read the error object returned. Usually it is just that the username or the email has been taken. You should communicate this to your users and ask them to try a different username. They may also be other kinds of errors that you should take note of.
You can use
loginWithUsername:password: to let users log in to their accounts by:
You can also use
loginWithEmail:password: to log in users with emails:
Of course, you also would want to allow users to log out of their accounts by using
To change the password of the current user:
You can get the
Please be reminded that the
currentUser object persist locally, and the
information (e.g. roles, emails, etc) might not sync with the server if it was
To get the latest information of the current user, you can call
Skygear provide a user discovery method by email. Everyone has access to this method without even having to be logged in.