Class Token

java.lang.Object
com.surrealdb.signin.Token

public class Token extends Object
Authentication tokens returned by signin and signup. Contains an access token (required) and an optional refresh token. When the server returns only a single JWT, it is exposed as the access token and refresh is null.
See Also:
  • Constructor Details

    • Token

      public Token(String access, String refresh)
      Creates a token with access and optional refresh token.
      Parameters:
      access - the access token (JWT), must not be null
      refresh - the refresh token, or null if not provided by the server
    • Token

      public Token(String token)
      Legacy constructor: single token string as access token, no refresh.
      Parameters:
      token - the access token
  • Method Details

    • getAccess

      public String getAccess()
      Returns the access token (JWT) used for authenticating requests.
      Returns:
      the access token
    • getRefresh

      public String getRefresh()
      Returns the refresh token if the server provided one, otherwise null.
      Returns:
      the refresh token or null
    • getToken

      public String getToken()
      Returns the access token. Kept for backward compatibility; prefer getAccess().
      Returns:
      the access token