Sign Up

Getting users registered with your application is the first step for user management.

Kii Platform allows users to register with a username/password combination. Optionally, a registration can be performed with phone numbers and/or email addresses.

When assigning an email address or phone number to a user, you can let Kii Cloud take the steps necessary to verify the credentials (either through a verification email or an SMS). Users won't be able to authenticate with those credentials until they've been validated. This feature allows you to prevent fake identities ( and that's all built into the Kii Platform!)

User Sign-Up

The following snippet shows how to sign up a user with the username user_123456, the e-mail address user_123456@example.com, a phone number +819012345678 and a password 123ABC.

KiiUser.Builder builder;
builder = KiiUser.BuilderWithName("user_123456");
builder.WithEmail("user_123456@example.com");
builder.WithPhone("+819012345678");
KiiUser user = builder.Build();

try
{
  user.Register("123ABC");
}
catch (Exception e)
{
  // Sign-up failed for some reasons.
  // Please check Exception to see what went wrong...
}

The basic steps are as follows:

  1. Create a KiiUser instance by calling the BuilderWithName method with a username, optionally setting an email address and phone number with the WithEmail and WithPhone methods. Then call the Build method.
  2. Register this KiiUser instance with the Register method passing the password as parameter. At this point, a new account will be created and the user will be signed-in.

Sign Up without a Username

You can also create a new account without a username. To create an account with an e-mail address or a phone number, use the BuilderWithEmail and BuilderWithPhone methods respectively. Note that in this case, the email and phone number (SMS) verification must be disabled (please check the next section for more details on the verification mechanism).

Sign up with a Local Phone Number

When you want to specify a local phone number, please also set a valid 2-letter country code using the Country property like in the following example:

string phoneNumber = "09051903944";
string country = "JP";
string password = "123456";
KiiUser user = KiiUser.BuilderWithPhone(phoneNumber).Build();
user.Country = country; // 2-letter country code
user.Register(password);

Enabling E-mail and/or Phone Verification

You can configure your application to verify the user's e-mail address and/or phone number. You can toggle the verification on/off on the developer portal as follows:

  1. Click the "Edit" button in your application console at the developer portal.

  2. Click "Settings" to bring up the application's configuration menu.

  3. Toggle SMS/Phone verification.

When enabled, the e-mail address and/or phone number will be verified as follows:

E-mail Verification:

When the e-mail verification is enabled and an account is registered with an email address, Kii Cloud will send an e-mail to the user with a verification link. Signing in with the specified e-mail address will only be allowed if the user previously clicked on the verification link.

Phone Verification:

When the phone verification is enabled and an account is registered with a phone number, Kii Cloud will send an SMS message with a verification code. Your application should then ask the user to type in the verification code to complete the registration. Signing-in with the specified phone number will only be allowed if the user previously submitted the correct verification code.

Please Note: You must specify a valid mobile phone number in an international phone number format (starting with + and your country code) in order to properly begin the SMS verification process.

After receiving the SMS verification code from the user, your application should call the VerifyPhone method to complete the verification process.

string code = "XYZXYZXYZ"; // Verification code
try
{
  user.VerifyPhone(code);
}
catch (Exception e) 
{
  // Sign-up failed for some reasons.
  // Please check Execption to see what went wrong...
}