createPhoneSession method
Create Phone session
Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the PUT /account/sessions/phone endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
Implementation
Future<models.Token> createPhoneSession(
{required String userId, required String phone}) async {
const String path = '/account/sessions/phone';
final Map<String, dynamic> params = {
'userId': userId,
'phone': phone,
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
final res = await client.call(HttpMethod.post,
path: path, params: params, headers: headers);
return models.Token.fromMap(res.data);
}