createRecovery method

Future<Token> createRecovery({
  1. required String email,
  2. required String url,
})

Create Password Recovery

Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the PUT /account/recovery endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.

Implementation

Future<models.Token> createRecovery(
    {required String email, required String url}) async {
  const String path = '/account/recovery';

  final Map<String, dynamic> params = {
    'email': email,
    'url': url,
  };

  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);
}