Reset Password (Email)
重置密码
final res = await supabase.auth.api.resetPasswordForEmail('user@example.com');
final error = res.error;
Notes
向一个电子邮件地址发送一个重置请求。
当用户点击邮件中的重置链接时,他们将被转发到。
<网站地址>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery
。
你的应用程序必须检测fragment中的type=recovery
,并向用户显示一个密码重置表单。
然后你应该使用url中的access_token和新密码来更新用户,如下所示:
final res = await supabase.auth.api.updateUser(
accessToken,
UserAttributes(password: 'NEW_PASSWORD'),
);
Examples
重置密码
final res = await supabase.auth.api.resetPasswordForEmail('user@example.com');
final error = res.error;