Skip to main content

User Register and Login

Registering a user​

info

Registering a user is an operation that requires a high permission level within the organization, so it can only be performed by providing an API Key to the Session.

csharp
async void RegisterUser()
{
// Create a new session
ServerSession session = new ServerSession(organization: "YOUR ORG ID");
// Authenticate it with an admin API Key
session.SessionContext.AuthenticateWithApiKey("YOUR API KEY");
bool success = await session.Register("username", "email", "password");
// ...
}
csharp
async void RegisterUser()
{
// Create a new session
ServerSession session = new ServerSession(organization: "YOUR ORG ID");
// Authenticate it with an admin API Key
session.SessionContext.AuthenticateWithApiKey("YOUR API KEY");
bool success = await session.Register("username", "email", "password");
// ...
}

Login​

csharp
async void Login()
{
bool success = await session.Login("username", "password");
// ...
}
csharp
async void Login()
{
bool success = await session.Login("username", "password");
// ...
}

Get User information​

csharp
async void GetUserInfo()
{
// Requires to be logged in
User user = await session.GetCurrentUser();
if(user == null)
Debug.LogError("Couldn't get current user's info")
// ...
}
csharp
async void GetUserInfo()
{
// Requires to be logged in
User user = await session.GetCurrentUser();
if(user == null)
Debug.LogError("Couldn't get current user's info")
// ...
}