Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class SupabaseSession
- Object
- 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
accessTokenString- the JWT sent with requests
refreshTokenString- the token that renews the session
expiresAtlong- when the access token expires, in seconds since the epoch
userIdString- the user ID
emailString- 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
jsonMap<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