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

public final class SupabaseSession

  1. Object
  2. SupabaseSession
A signed-in Supabase user session: the access token, the refresh token and when the access token expires.

Constructors

public SupabaseSession(String accessToken, String refreshToken, long expiresAt, String userId, String email)Creates a session.

Methods

public static SupabaseSession fromJson(Map<String, Object> json)Reads a session from a GoTrue token response.
public String getAccessToken()The access token (a JWT).
public String getRefreshToken()The refresh token.
public long getExpiresAt()When the access token expires.
public String getUserId()The user ID.
public String getEmail()The user’s email.
public boolean isExpired()True when the access token expires within the next minute.

Inherited methods

Constructor details

SupabaseSession

public SupabaseSession(String accessToken, String refreshToken, long expiresAt, String userId, String email)
Creates a session.

Parameters

accessToken String
the JWT sent with requests
refreshToken String
the token that renews the session
expiresAt long
when the access token expires, in seconds since the epoch
userId String
the user ID
email String
the user’s email, may be null

Method details

fromJson

public static SupabaseSession fromJson(Map<String, Object> json)
Reads a session from a GoTrue token response.

Parameters

json Map<String, Object>
the parsed response

Returns

the session, or null when the response holds no access token

getAccessToken

public String getAccessToken()
The access token (a JWT).

Returns

the token

getRefreshToken

public String getRefreshToken()
The refresh token.

Returns

the token, may be null

getExpiresAt

public long getExpiresAt()
When the access token expires.

Returns

seconds since the epoch

getUserId

public String getUserId()
The user ID.

Returns

the ID, may be null

getEmail

public String getEmail()
The user’s email.

Returns

the email, may be null

isExpired

public boolean isExpired()
True when the access token expires within the next minute.

Returns

whether the session needs a refresh