pub struct Auth { /* private fields */ }
Expand description
Auth クライアント
Implementations§
Source§impl Auth
impl Auth
Sourcepub fn new(
url: &str,
key: &str,
http_client: Client,
options: AuthOptions,
) -> Self
pub fn new( url: &str, key: &str, http_client: Client, options: AuthOptions, ) -> Self
新しい Auth クライアントを作成
Sourcepub fn init_admin(&mut self, service_role_key: &str) -> &Self
pub fn init_admin(&mut self, service_role_key: &str) -> &Self
Sourcepub fn admin(&self) -> Option<&AdminAuth>
pub fn admin(&self) -> Option<&AdminAuth>
管理者用APIクライアントを取得
§例
if let Some(admin) = auth.admin() {
// Use admin API here
// let users = admin.list_users(None, None).await?;
}
Sourcepub async fn sign_up(
&self,
email: &str,
password: &str,
) -> Result<Session, AuthError>
pub async fn sign_up( &self, email: &str, password: &str, ) -> Result<Session, AuthError>
ユーザー登録
Sourcepub async fn sign_in_with_password(
&self,
email: &str,
password: &str,
) -> Result<Session, AuthError>
pub async fn sign_in_with_password( &self, email: &str, password: &str, ) -> Result<Session, AuthError>
メール・パスワードでログイン
Sourcepub fn get_session(&self) -> Option<Session>
pub fn get_session(&self) -> Option<Session>
現在のセッションを取得
Sourcepub async fn refresh_session(&self) -> Result<Session, AuthError>
pub async fn refresh_session(&self) -> Result<Session, AuthError>
セッションをリフレッシュ
Sourcepub async fn reset_password_for_email(
&self,
email: &str,
) -> Result<(), AuthError>
pub async fn reset_password_for_email( &self, email: &str, ) -> Result<(), AuthError>
パスワードリセットメールの送信
Sourcepub fn get_oauth_sign_in_url(
&self,
provider: OAuthProvider,
options: Option<OAuthSignInOptions>,
) -> String
pub fn get_oauth_sign_in_url( &self, provider: OAuthProvider, options: Option<OAuthSignInOptions>, ) -> String
OAuth プロバイダを通じたサインインのためのURL生成
Sourcepub async fn sign_in_with_oauth(
&self,
provider: OAuthProvider,
options: Option<OAuthSignInOptions>,
) -> Result<String, AuthError>
pub async fn sign_in_with_oauth( &self, provider: OAuthProvider, options: Option<OAuthSignInOptions>, ) -> Result<String, AuthError>
OAuthで認証をリクエスト
Sourcepub async fn exchange_code_for_session(
&self,
code: &str,
) -> Result<Session, AuthError>
pub async fn exchange_code_for_session( &self, code: &str, ) -> Result<Session, AuthError>
OAuthコールバックからのコードを処理してセッション取得
Sourcepub async fn sign_in_with_password_mfa(
&self,
email: &str,
password: &str,
) -> Result<Result<Session, MFAChallenge>, AuthError>
pub async fn sign_in_with_password_mfa( &self, email: &str, password: &str, ) -> Result<Result<Session, MFAChallenge>, AuthError>
MFAで保護されたサインイン - 最初のステップ(パスワードでの認証)
このメソッドは通常のサインインプロセスと同様ですが、ユーザーが MFAを有効化している場合は、次のステップで検証が必要なチャレンジを返します。
Sourcepub async fn verify_mfa_challenge(
&self,
challenge_id: &str,
code: &str,
) -> Result<Session, AuthError>
pub async fn verify_mfa_challenge( &self, challenge_id: &str, code: &str, ) -> Result<Session, AuthError>
MFAチャレンジの検証 - 第二ステップ(コードによる検証)
Sourcepub async fn enroll_totp(&self) -> Result<TOTPSetupInfo, AuthError>
pub async fn enroll_totp(&self) -> Result<TOTPSetupInfo, AuthError>
MFAファクターを登録する
Sourcepub async fn verify_totp(
&self,
factor_id: &str,
code: &str,
) -> Result<MFAFactor, AuthError>
pub async fn verify_totp( &self, factor_id: &str, code: &str, ) -> Result<MFAFactor, AuthError>
TOTP MFAファクターを検証して有効化
Sourcepub async fn sign_in_anonymously(&self) -> Result<Session, AuthError>
pub async fn sign_in_anonymously(&self) -> Result<Session, AuthError>
匿名認証でサインイン
Sourcepub async fn send_confirm_email_request(
&self,
email: &str,
options: Option<EmailConfirmOptions>,
) -> Result<(), AuthError>
pub async fn send_confirm_email_request( &self, email: &str, options: Option<EmailConfirmOptions>, ) -> Result<(), AuthError>
Sourcepub async fn verify_password_reset(
&self,
token: &str,
new_password: &str,
) -> Result<Session, AuthError>
pub async fn verify_password_reset( &self, token: &str, new_password: &str, ) -> Result<Session, AuthError>
pub async fn send_verification_code( &self, phone: &str, ) -> Result<PhoneVerificationResponse, AuthError>
Auto Trait Implementations§
impl Freeze for Auth
impl !RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl !UnwindSafe for Auth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more