Class SyncCredentials

java.lang.Object
io.objectbox.sync.SyncCredentials
Direct Known Subclasses:
SyncCredentialsToken, SyncCredentialsUserPassword

public abstract class SyncCredentials extends Object
Use the static helper methods to build Sync credentials, for example SyncCredentials.sharedSecret("secret").
  • Field Details

  • Constructor Details

  • Method Details

    • sharedSecret

      public static SyncCredentials sharedSecret(String secret)
      Authenticate with a shared secret. This could be a passphrase, big number or randomly chosen bytes. The string is expected to use UTF-8 characters.
    • sharedSecret

      public static SyncCredentials sharedSecret(byte[] secret)
      Authenticate with a shared secret. This could be a passphrase, big number or randomly chosen bytes.
    • google

      public static SyncCredentials google(String idToken)
      Authenticate with a Google account ID token obtained via Google Sign-In.
    • obxAdminUser

      public static SyncCredentials obxAdminUser(String user, String password)
      ObjectBox admin users (username/password)
    • userAndPassword

      public static SyncCredentials userAndPassword(String user, String password)
      Generic credential type suitable for ObjectBox admin (and possibly others in the future)
    • jwtIdToken

      public static SyncCredentials jwtIdToken(String jwtIdToken)
      JSON Web Token (JWT): an ID token that typically provides identity information about the authenticated user.
    • jwtAccessToken

      public static SyncCredentials jwtAccessToken(String jwtAccessToken)
      JSON Web Token (JWT): an access token that is used to access resources.
    • jwtRefreshToken

      public static SyncCredentials jwtRefreshToken(String jwtRefreshToken)
      JSON Web Token (JWT): a refresh token that is used to obtain a new access token.
    • jwtCustomToken

      public static SyncCredentials jwtCustomToken(String jwtCustomToken)
      JSON Web Token (JWT): a token that is neither an ID, access, nor refresh token.
    • none

      public static SyncCredentials none()
      No authentication, unsecured. Use only for development and testing purposes.
    • getType

    • getTypeId

      public long getTypeId()
    • createClone

      abstract SyncCredentials createClone()
      Creates a copy of these credentials.

      This can be useful to use the same credentials when creating multiple clients or a server in combination with a client as some credentials may get cleared when building a client or server.