Representation of an authenticated user of an App.
The access token used when requesting a new access token.
The access token as a string or
You can store arbitrary data about your application users in a MongoDB collection and configure Atlas App Services to automatically expose each user’s data in a field of their user object. For example, you might store a user’s preferred language, date of birth, or their local timezone.
If this value has not been configured, it will be empty.
The custom data as an object.
The ID of the device.
The device ID as a string or
The automatically-generated internal ID of the user.
The user ID as a string.
The logged in state of the user.
true if the user is logged in,
The refresh token used when requesting a new access token.
The refresh token as a string or
Adds a listener that will be fired on various user related events. This includes auth token refresh, refresh token refresh, refresh custom user data, and logout.
The callback to be fired when the event occurs.
Call a remote Atlas App Services Function by its name.
Name of the App Services Function.
Rest ...args: unknown
Arguments passed to the Function.
A promise that resolves to the value returned by the Function.
functions[name]() instead of calling this method.
// These are all equivalent:
await user.callFunction("doThing", a1, a2, a3);
await user.functions.doThing(a1, a2, a3);
await user.functions["doThing"](a1, a2, a3);
// The methods returned from the functions object are bound, which is why it's okay to store the function in a variable before calling it:
const doThing = user.functions.doThing;
Link the user with an identity represented by another set of credentials.
The credentials to use when linking.
A promise that resolves once the user has been linked with the credentials.
Log out the user.
A promise that resolves once the user has been logged out of the app.
Refresh the access token and derive custom data from it.
A promise that resolves to the refreshed custom data.
Removes all event listeners previously added via User.addListener.
Generated using TypeDoc