Class SupabaseSession
java.lang.Object
com.codename1.cloud.supabase.SupabaseSession
A signed-in Supabase user session: the access token, the refresh token
and when the access token expires.
-
Constructor Summary
ConstructorsConstructorDescriptionSupabaseSession(String accessToken, String refreshToken, long expiresAt, String userId, String email) Creates a session. -
Method Summary
Modifier and TypeMethodDescriptionstatic SupabaseSessionReads a session from a GoTrue token response.The access token (a JWT).getEmail()The user's email.longWhen the access token expires.The refresh token.The user ID.booleanTrue when the access token expires within the next minute.
-
Constructor Details
-
SupabaseSession
public SupabaseSession(String accessToken, String refreshToken, long expiresAt, String userId, String email) Creates a session.
Parameters
-
accessToken: the JWT sent with requests -
refreshToken: the token that renews the session -
expiresAt: when the access token expires, in seconds since the epoch -
userId: the user ID -
email: the user's email, may be null
-
-
-
Method Details
-
fromJson
Reads a session from a GoTrue token response.
Parameters
json: the parsed response
Returns
the session, or null when the response holds no access token
-
getAccessToken
The access token (a JWT).
Returns
the token
-
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
The user ID.
Returns
the ID, may be null
-
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
-