Class User
On this page
- io.realm.mongodb
- Nested Class Summary
- Method Summary
- Inherited Methods
- Method Detail
- equals
- getAccessToken
- getApiKeys
- getApp
- getCustomData
- getDeviceId
- getFunctions
- getId
- getIdentities
- getMongoClient
- getProfile
- getProviderType
- getPush
- getRefreshToken
- getState
- hashCode
- isLoggedIn
- linkCredentials
- linkCredentialsAsync
- logOut
- logOutAsync
- refreshCustomData
io.realm.mongodb
A user holds the user's meta data and tokens for accessing Realm App functionality.The user is used to configure Synchronized Realms and gives access to calling Realm App Functions through Functions and accessing remote Realm App
Mongo Databases through a MongoClient .
- App.login(Credentials)
- io.realm.mongodb.sync.SyncConfiguration.Builder.Builder(User, String)
Nested Class Summary
Modifier and Type | Class and Description |
---|---|
public static final |
Method Summary
Modifier and Type | Method and Description |
---|---|
public boolean | |
public String | Returns the current access token for the user. |
public synchronized ApiKeyAuth | getApiKeys () Returns a wrapper for managing API keys controlled by the current user. |
public App | |
public Document | Return the custom user data associated with the user in the Realm App. |
public String | getDeviceId () Returns a unique identifier for the device the user logged in to. |
public Functions | Returns a functions manager for invoking Realm Functions with custom codec registry for encoding and decoding arguments and results. |
public synchronized Functions | getFunctions () Returns a functions manager for invoking MongoDB Realm Functions. |
public String | getId () Returns the server id of the user. |
public List | Returns a new list of the user's identities. |
public synchronized MongoClient | Returns a MongoClient instance for accessing documents in the database. |
public UserProfile | getProfile () Returns the profile for this user. |
public Credentials.Provider | Returns the provider type used to log the user |
public synchronized Push | |
public String | Returns the current refresh token for the user. |
public User.State | |
public int | hashCode () |
public boolean | isLoggedIn () Returns true if the user is currently logged in. |
public User | Links the current user with a new user identity represented by the given credentials. |
public RealmAsyncTask | Credentials credentials, ) Links the current user with a new user identity represented by the given credentials. |
public void | logOut () Log the user out of the Realm App. |
public RealmAsyncTask | Log the user out of the Realm App asynchronously. |
public RealmAsyncTask | Re-fetch custom user data from the Realm App asynchronously. |
public Document | Re-fetch custom user data from the Realm App. |
Inherited Methods
- Methods inherited from class java.lang.Object :
getClass
,hashCode
,equals
,clone
,toString
,notify
,notifyAll
,wait
,wait
,wait
,finalize
Method Detail
equals
getAccessToken
public String getAccessToken () |
---|
Returns the current access token for the user. Returns the current access token. |
getApiKeys
public synchronized ApiKeyAuth getApiKeys () |
---|
Returns a wrapper for managing API keys controlled by the current user. Returns wrapper for managing API keys controlled by the current user. Throws
|
getApp
getCustomData
public Document getCustomData () |
---|
Return the custom user data associated with the user in the Realm App.The data is only refreshed when the user's access token is refreshed or when explicitly calling refreshCustomData() . Returns The custom user data associated with the user. |
getDeviceId
public String getDeviceId () |
---|
Returns a unique identifier for the device the user logged in to. Returns a unique device identifier for the user. |
getFunctions
Returns a functions manager for invoking Realm Functions with custom codec registry for encoding and decoding arguments and results. Parameters
Tip See also: |
public synchronized Functions getFunctions () |
---|
Returns a functions manager for invoking MongoDB Realm Functions.This will use the associated app's default codec registry to encode and decode arguments and results. Tip See also: |
getId
getIdentities
public List getIdentities () |
---|
Returns a new list of the user's identities. Returns the list of identities. Tip See also: |
getMongoClient
Returns a MongoClient instance for accessing documents in the database. Parameters
|
getProfile
public UserProfile getProfile () |
---|
Returns the profile for this user. Returns the profile for this user |
getProviderType
public Credentials.Provider getProviderType () |
---|
Returns the provider type used to log the user Returns the provider type of the user |
getPush
getRefreshToken
public String getRefreshToken () |
---|
Returns the current refresh token for the user. Returns the current refresh token. |
getState
public User.State getState () |
---|
hashCode
isLoggedIn
public boolean isLoggedIn () |
---|
Returns true if the user is currently logged in. Returns whether or not this user is still logged into the MongoDB Realm App. Returns
|
linkCredentials
Links the current user with a new user identity represented by the given credentials.Linking a user with more credentials, mean the user can login either of these credentials. It also makes it possible to "upgrade" an anonymous user by linking it with e.g. Email/Password credentials.
Note: It is not possible to link two existing users of MongoDB Realm. The provided credentials must not have been used by another user. Parameters
Returns the User the credentials were linked to. Throws
|
linkCredentialsAsync
Links the current user with a new user identity represented by the given credentials.Linking a user with more credentials, mean the user can login either of these credentials. It also makes it possible to "upgrade" an anonymous user by linking it with e.g. Email/Password credentials.
Note: It is not possible to link two existing users of MongoDB Realm. The provided credentials must not have been used by another user. Parameters
Throws
|
logOut
public void logOut () |
---|
Log the user out of the Realm App. This will unregister them on the device, stop any synchronization to and from the users' Realms, and those Realms will be deleted next time the app restarts. Therefor logging out should not be done until all changes to Realms have been uploaded to the server.Once the Realm App has confirmed the logout any registered AuthenticationListener will be notified and user credentials will be deleted from this device. Logging out anonymous users will remove them immediately instead of marking them as User.State.LOGGED_OUT . All other users will be marked as User.State.LOGGED_OUT and will still be returned by App.allUsers() . They can be removed completely by calling App.removeUser(User ()}. Throws
|
logOutAsync
Log the user out of the Realm App asynchronously. This will unregister them on the device, stop any synchronization to and from the users' Realms, and those Realms will be deleted next time the app restarts. Therefor logging out should not be done until all changes to Realms have been uploaded to the server.Once the Realm App has confirmed the logout any registered AuthenticationListener will be notified and user credentials will be deleted from this device. Logging out anonymous users will remove them immediately instead of marking them as User.State.LOGGED_OUT . All other users will be marked as User.State.LOGGED_OUT and will still be returned by App.allUsers() . They can be removed completely by calling App.removeUser(User) ()}. Parameters
Throws
|
refreshCustomData
Re-fetch custom user data from the Realm App asynchronously.This is the asynchronous variant of refreshCustomData() . Parameters
Returns The task representing the ongoing operation. Throws
|
public Document refreshCustomData () |
---|
Re-fetch custom user data from the Realm App. Returns The updated custom user data associated with the user. Throws
|