Auth

Struct Auth 

Source
pub struct Auth { /* private fields */ }

Implementations§

Source§

impl Auth

Source

pub fn builder(app: FirebaseApp) -> AuthBuilder

Creates a builder for configuring an Auth instance before construction.

Source

pub fn new(app: FirebaseApp) -> AuthResult<Self>

Constructs an Auth instance using in-memory persistence.

Source

pub fn new_with_persistence( app: FirebaseApp, persistence: Arc<dyn AuthPersistence + Send + Sync>, ) -> AuthResult<Self>

Constructs an Auth instance with a caller-provided persistence backend.

Source

pub fn initialize(self: &Arc<Self>) -> AuthResult<()>

Finishes initialization by restoring persisted state and wiring listeners.

Source

pub fn app(&self) -> &FirebaseApp

Returns the FirebaseApp associated with this Auth instance.

Source

pub fn current_user(&self) -> Option<Arc<User>>

Returns the currently signed-in user, if any.

Source

pub fn sign_out(&self)

Signs out the current user and clears persisted credentials.

Source

pub fn email_auth_provider(&self) -> EmailAuthProvider

Returns the email/password auth provider helper.

Source

pub fn sign_in_with_email_and_password( &self, email: &str, password: &str, ) -> AuthResult<UserCredential>

Signs a user in using the email/password REST endpoint.

Source

pub fn create_user_with_email_and_password( &self, email: &str, password: &str, ) -> AuthResult<UserCredential>

Creates a new user using email/password credentials.

Source

pub fn on_auth_state_changed( &self, observer: PartialObserver<Arc<User>>, ) -> impl FnOnce() + Send + 'static

Registers an observer that is invoked whenever auth state changes.

Source

pub fn get_token(&self, force_refresh: bool) -> AuthResult<Option<String>>

Returns the current user’s ID token, refreshing when requested.

Source

pub fn token_provider(self: &Arc<Self>) -> TokenProviderArc

Exposes this auth instance as a Firestore token provider.

Source

pub fn set_oauth_request_uri(&self, value: impl Into<String>)

Overrides the default OAuth request URI used during flows.

Source

pub fn oauth_request_uri(&self) -> String

Returns the OAuth request URI for popup/redirect flows.

Source

pub fn set_identity_toolkit_endpoint(&self, endpoint: impl Into<String>)

Updates the Identity Toolkit REST endpoint.

Source

pub fn identity_toolkit_endpoint(&self) -> String

Returns the Identity Toolkit REST endpoint in use.

Source

pub fn set_secure_token_endpoint(&self, endpoint: impl Into<String>)

Sets the Secure Token endpoint used for refresh operations.

Source

pub fn set_popup_handler(&self, handler: Arc<dyn OAuthPopupHandler>)

Installs an OAuth popup handler implementation.

Source

pub fn clear_popup_handler(&self)

Clears any installed popup handler.

Source

pub fn popup_handler(&self) -> Option<Arc<dyn OAuthPopupHandler>>

Retrieves the currently configured popup handler.

Source

pub fn set_redirect_handler(&self, handler: Arc<dyn OAuthRedirectHandler>)

Installs an OAuth redirect handler implementation.

Source

pub fn clear_redirect_handler(&self)

Clears any installed redirect handler.

Source

pub fn redirect_handler(&self) -> Option<Arc<dyn OAuthRedirectHandler>>

Retrieves the currently configured redirect handler.

Source

pub fn set_redirect_persistence( &self, persistence: Arc<dyn RedirectPersistence>, )

Replaces the persistence mechanism used for redirect state.

Source

pub fn sign_in_with_oauth_credential( &self, credential: AuthCredential, ) -> AuthResult<UserCredential>

Signs in using an OAuth credential produced by popup/redirect flows.

Source

pub fn send_password_reset_email(&self, email: &str) -> AuthResult<()>

Sends a password reset email to the specified address.

Source

pub fn confirm_password_reset( &self, oob_code: &str, new_password: &str, ) -> AuthResult<()>

Confirms a password reset OOB code and applies the new password.

Source

pub fn send_email_verification(&self) -> AuthResult<()>

Sends an email verification message to the currently signed-in user.

Source

pub fn update_profile( &self, display_name: Option<&str>, photo_url: Option<&str>, ) -> AuthResult<Arc<User>>

Updates the current user’s display name and photo URL.

Source

pub fn update_email(&self, email: &str) -> AuthResult<Arc<User>>

Updates the current user’s email address.

Source

pub fn update_password(&self, password: &str) -> AuthResult<Arc<User>>

Updates the current user’s password.

Source

pub fn delete_user(&self) -> AuthResult<()>

Deletes the current user from Firebase Auth.

Unlinks the specified providers from the current user.

Source

pub fn get_account_info(&self) -> AuthResult<GetAccountInfoResponse>

Fetches the latest account info for the current user.

Links an OAuth credential with the currently signed-in user.

Source

pub fn reauthenticate_with_password( &self, email: &str, password: &str, ) -> AuthResult<Arc<User>>

Reauthenticates the current user with email and password.

Source

pub fn reauthenticate_with_oauth_credential( &self, credential: AuthCredential, ) -> AuthResult<Arc<User>>

Reauthenticates the current user with an OAuth credential.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,