Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class SupabaseAuth

  1. Object
  2. SupabaseAuth

Email and password auth against Supabase GoTrue.

The session is saved in Preferences and restored on the next launch, so a user stays signed in until signOut().

Methods

public SupabaseSession getSession()The current session, restored from Preferences on first use.
public void setSession(SupabaseSession s)Replaces the session and saves it.
public boolean isSignedIn()True when a session exists.
public AsyncResource<SupabaseSession> signUp(String email, String password)Creates a user.
public AsyncResource<SupabaseSession> signIn(String email, String password)Signs in with email and password.
public AsyncResource<SupabaseSession> refresh()Exchanges the refresh token for a new session.
public AsyncResource<Boolean> signOut()Signs out on the server and forgets the session locally.

Inherited methods

Method details

getSession

public SupabaseSession getSession()
The current session, restored from Preferences on first use.

Returns

the session, or null when nobody is signed in

setSession

public void setSession(SupabaseSession s)
Replaces the session and saves it. Pass null to forget it.

Parameters

s SupabaseSession
the session, or null

isSignedIn

public boolean isSignedIn()
True when a session exists.

Returns

whether a user is signed in

signUp

public AsyncResource<SupabaseSession> signUp(String email, String password)
Creates a user. When the project requires email confirmation the result completes with null, since there is no session yet.

Parameters

email String
the email
password String
the password

Returns

the new session, or null pending confirmation

signIn

public AsyncResource<SupabaseSession> signIn(String email, String password)
Signs in with email and password.

Parameters

email String
the email
password String
the password

Returns

the session

refresh

public AsyncResource<SupabaseSession> refresh()
Exchanges the refresh token for a new session. Concurrent calls share one request.

Returns

the new session; fails when there is no refresh token

signOut

public AsyncResource<Boolean> signOut()
Signs out on the server and forgets the session locally.

Returns

completes with true once the local session is cleared