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/
Fields§
§client: Client
§project_url: String
REST endpoint for querying and managing your database
Example: https://
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
impl AuthClient
sourcepub fn new<S: Into<String>>(
project_url: Option<S>,
api_key: Option<S>,
jwt_secret: Option<S>,
) -> Self
pub fn new<S: Into<String>>( project_url: Option<S>, api_key: Option<S>, jwt_secret: Option<S>, ) -> Self
Create a new AuthClient
Will use SUPABASE_URL
SUPABASE_API_KEY
and SUPABASE_JWT_SECRET
environment variables if no params are provided
pub async fn sign_in_with_email_and_password<S: Into<String>>( &self, email: S, password: S, ) -> Result<Session, Error>
pub async fn sign_in_with_phone_and_password<S: Into<String>>( &self, phone: S, password: S, ) -> Result<Session, Error>
pub async fn sign_up_with_email_and_password<S: Into<String>>( &self, email: S, password: S, ) -> Result<Session, Error>
pub async fn sign_up_with_phone_and_password<S: Into<String>>( &self, phone: S, password: S, ) -> Result<Session, Error>
pub async fn send_login_email_with_magic_link<S: Into<String>>( &self, email: S, ) -> Result<Response, Error>
pub async fn send_sms_with_otp<S: Into<String>>( &self, phone: S, ) -> Result<Response, Error>
pub async fn sign_in_with_oauth( &self, provider: Provider, ) -> Result<Response, Error>
sourcepub async fn get_user<S: Into<String>>(
&self,
bearer_token: S,
) -> Result<User, Error>
pub async fn get_user<S: Into<String>>( &self, bearer_token: S, ) -> Result<User, Error>
Get the User struct of the logged in user
sourcepub async fn forgotten_password_email<S: Into<String>>(
&self,
email: S,
) -> Result<(), Error>
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.
sourcepub async fn update_user<S: Into<String>>(
&self,
updated_user: UpdateUserPayload,
bearer_token: S,
) -> Result<User, Error>
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
sourcepub async fn sign_in_with_id_token(
&self,
credentials: SignInWithIdTokenCredentials,
) -> Result<Session, Error>
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.