sendSignInCode method

Future<APIError?> sendSignInCode(
  1. String phone
)

Sends an SMS code (OTP - one time password) that can be used to sign in to the phone number of the user.

This method works only if sign in using authorization codes is enabled in your app authentication settings and the user's phone number has already been verified.

After getting the SMS code you can call the signInWithCode method. Altogic verifies the validity of the code and if successful returns the auth grants (e.g., session) of the user.

If sign in using authorization codes is disabled in your app authentication settings or if the user's phone has not been verified, it returns an error.

phone The phone number of the user to send the SMS code.

Implementation

Future<APIError?> sendSignInCode(String phone) async =>
    (await _fetcher.post<dynamic>(
            '/_api/rest/v1/auth/send-code${encodeUriParameters({
          "phone": phone
        })}'))
        .errors;