Struct supabase_auth::client::AuthClient

source ·
pub struct AuthClient {
    pub client: Client,
    pub project_url: String,
    pub api_key: String,
    pub jwt_secret: String,
}
Expand description

Supabase Auth Client You can find your project url and keys at https://supabase.com/dashboard/project//settings/api

Fields§

§client: Client§project_url: String

REST endpoint for querying and managing your database Example: https://.supabase.co

§api_key: String

WARN: The service role key has the ability to bypass Row Level Security. Never share it publicly.

§jwt_secret: String

Used to decode your JWTs. You can also use this to mint your own JWTs.

Implementations§

source§

impl AuthClient

source

pub fn new( project_url: impl Into<String>, api_key: impl Into<String>, jwt_secret: impl Into<String>, ) -> Self

Create a new AuthClient

source

pub fn new_from_env() -> Result<AuthClient, Error>

Create a new AuthClient from environment variables Requires SUPABASE_URL, SUPABASE_API_KEY, and SUPABASE_JWT_SECRET environment variables

source

pub async fn sign_in_with_email_and_password<S: Into<String>>( &self, email: S, password: S, ) -> Result<Session, Error>

source

pub async fn sign_in_with_phone_and_password<S: Into<String>>( &self, phone: S, password: S, ) -> Result<Session, Error>

source

pub async fn sign_up_with_email_and_password<S: Into<String>>( &self, email: S, password: S, ) -> Result<Session, Error>

source

pub async fn sign_up_with_phone_and_password<S: Into<String>>( &self, phone: S, password: S, ) -> Result<Session, Error>

source

pub async fn send_sms_with_otp<S: Into<String>>( &self, phone: S, ) -> Result<Response, Error>

source

pub async fn send_email_with_otp<S: Into<String>>( &self, email: S, options: Option<SignInEmailOtpParams>, ) -> Result<Response, Error>

source

pub async fn sign_in_with_oauth( &self, provider: Provider, ) -> Result<Response, Error>

source

pub async fn get_user<S: Into<String>>( &self, bearer_token: S, ) -> Result<User, Error>

Get the User struct of the logged in user

source

pub async fn forgotten_password_email<S: Into<String>>( &self, email: S, ) -> Result<(), Error>

Sends the user a log in link via email. Once logged in you should direct the user to a new password form. And use “Update User” below to save the new password.

source

pub async fn update_user<S: Into<String>>( &self, updated_user: UpdateUserPayload, bearer_token: S, ) -> Result<User, Error>

Update the user with a new email or password. Each key (email, password, and data) is optional

source

pub async fn sign_in_with_id_token( &self, credentials: SignInWithIdTokenCredentials, ) -> Result<Session, Error>

Allows signing in with an OIDC ID token. The authentication provider used should be enabled and configured.

source

pub async fn invite_user_by_email<S: Into<String>>( &self, email: S, ) -> Result<User, Error>

Sends an invite link to an email address.

source

pub async fn verify_otp( &self, params: VerifyOtpParams, ) -> Result<Session, Error>

Auto Trait Implementations§

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, 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<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