Realm.Sync.Credentials

Class for creating user credentials

identityProvider

Gets the identity provider for the credentials.

token

Gets the access token.

userInfo

Gets additional user information associated with the credentials.

Realm.Sync.Credentials.adminToken(token)Credentials
static

Creates credentials based on an admin token. Using this credential will not contact the Realm Object Server.

Parameters:
  • token
    • Type: string
    • The admin token.

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.anonymous()Credentials
static

Creates credentials for an anonymous user. These can only be used once - using them a second time will result in a different user being logged in. If you need to get a user that has already logged in with the Anonymous credentials, use User.current or User.all

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.azureAD(token)Credentials
static

Creates credentials based on an Active Directory login.

Parameters:
  • token
    • Type: string
    • An access token, obtained by logging into Azure Active Directory.

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.custom(providerName, token, userInfo)Credentials
static

Creates credentials with a custom provider and user identifier.

Parameters:
  • providerName
    • Type: string
    • Provider used to verify the credentials.

  • token
    • Type: string
    • A string identifying the user. Usually an identity token or a username.

  • userInfo
    • Type: userInfo
    • Data describing the user further or null if the user does not have any extra data. The data will be serialized to JSON, so all values must be mappable to a valid JSON data type.

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.facebook(token)Credentials
static

Creates credentials based on a Facebook login.

Parameters:
  • token
    • Type: string
    • A Facebook authentication token, obtained by logging into Facebook..

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.google(token)Credentials
static

Creates credentials based on a Google login.

Parameters:
  • token
    • Type: string
    • A Google authentication token, obtained by logging into Google..

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.jwt(token, providerName)Credentials
static

Creates credentials based on a JWT login.

Parameters:
  • token
    • Type: string
    • A JSON Web Token, that will be validated against the server's configured rules.

  • providerName optional
    • Type: string
    • The name of the provider as configured in the Realm Object. If not specified, the default name - jwt - will be used.

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.nickname(value, isAdmin)Credentials
static

Creates credentials based on a login with a nickname. If multiple users try to login with the same nickname, they'll get the same underlying sync user.

Parameters:
  • value
    • Type: string
    • The nickname of the user.

  • isAdmin optional
    • Type: boolean
    • An optional parameter controlling whether the user is admin. Default is false.

Returns: Credentials An instance of Credentials that can be used in User.login.
Realm.Sync.Credentials.usernamePassword(username, password, createUser)Credentials
static

Creates credentials based on a login with a username and a password.

Parameters:
  • username
    • Type: string
    • The username of the user.

  • password
    • Type: string
    • The user's password.

  • createUser optional
    • Type: boolean
    • optional - true if the user should be created, false otherwise. If true is provided and the user exists, or false is provided and the user doesn't exist, an error will be thrown. If not specified, if the user doesn't exist, they will be created, otherwise, they'll be logged in if the password matches.

Returns: Credentials An instance of Credentials that can be used in User.login.