Class SupabaseAuth

java.lang.Object
com.codename1.cloud.supabase.SupabaseAuth

public class SupabaseAuth extends Object

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().

  • 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: 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: the email

      • password: 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: the email

      • password: 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