Auth
Plugin to interact with the Supabase Auth API
To use it you need to install it to the SupabaseClient:
val supabase = createSupabaseClient(supabaseUrl, supabaseKey) {
install(Auth)
}
then you can use it like this:
val result = supabase.auth.signUpWith(Email) {
email = "example@email.com"
password = "password"
}
Properties
Access to the auth admin api where you can manage users. Service role access token is required. Import it via importAuthToken. Never share it publicly
The cache for the code verifier. This is used for PKCE authentication. Can be customized via AuthConfig.codeVerifierCache
Whether the sessionStatus session is getting refreshed automatically
Returns the session manager instance
Returns the current session status
Functions
Blocks the current coroutine until the plugin is initialized.
Deletes the current session from storage and sets sessionStatus to SessionStatus.NotAuthenticated
Returns the current access token, or null if no session is available
Returns the connected identities to the current user or null
Returns the current session or null
Returns the current user or null
Exchanges a code for a session. Used when using the FlowType.PKCE flow
Returns the url to use for oAuth
Imports the jwt token and retrieves the user profile. Be aware auto-refreshing is not available when importing only a jwt token.
Imports a user session and starts auto-refreshing if autoRefresh is true
Links an OAuth Identity to an existing user.
Retrieves the latest session from storage and starts auto-refreshing if autoRefresh is true or AuthConfig.alwaysAutoRefresh as the default parameter
Parses a session from a fragment.
Parses a session from an url.
Sends a nonce to the user's email (preferred) or phone
Refreshes the current session
Refreshes a session using the refresh token
Resends an existing signup confirmation email, email change email
Resends an existing SMS OTP or phone change OTP.
Sends a password reset email to the user with the specified email
Retrieves the sso url for the given config
Retrieves the user attached to the specified jwt
Retrieves the current user with the current session
Signs in the user without any credentials. This will create a new user session with a new access token.
Signs out the current user, which means sessionStatus will be SessionStatus.NotAuthenticated and the access token will be revoked
Starts auto refreshing the current session
Stops auto-refreshing the current session
Unlinks an OAuth Identity from an existing user.
Modifies the current user
Verifies a email otp token hash received via email
Verifies a email otp
Verifies a phone/sms otp