Class SyncCredentials

Credentials represent a login with a 3rd party login provider in an OAuth2 login flow, and are used by the Realm
Object Server to verify the user and grant access.

Logging into the Realm Object Server consists of the following steps:

Log in to 3rd party provider (Facebook or Google). The result is usually an Authorization Grant that must be
saved in a SyncCredentials object of the proper type e.g., facebook(String) for a
Facebook login.

Authenticate a SyncUser through the Object Server using these credentials. Once authenticated,
an Object Server user is returned. Then this user can be attached to a SyncConfiguration, which
will make it possible to synchronize data between the local and remote Realm.

It is possible to persist the user object e.g., using the UserStore. That means, logging
into an OAuth2 provider is only required the first time the app is used.

custom

Creates a custom set of credentials. The behaviour will depend on the type of identityProvider and
userInfo used.

Parameters:

userIdentifier - String identifying the user. Usually a username or user token.

identityProvider - provider used to verify the credentials.

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. Custom
classes will be converted using toString().

accessToken

Creates credentials from an existing access token. Since an access token is the proof that a user already
has logged in. Credentials created this way are automatically assumed to have successfully logged in.
This means that providing this credential to SyncUser.login(SyncCredentials, String) will always
succeed, but accessing any Realm after might fail if the token is no longer valid.