How to get information about the logged in user from the Cosync REST API #
The getUser function will retrieve information about the logged in user. The function call must be passed the access-token of the logged in user to work. This function cannot be used to retrieve information about other users in the system, it is restricted solely to the logged in user.
URL #
/api/appuser/getUser
Method #
GET
Headers #
access-token: "<Access Token>"
Data Parameter #
None
Response: #
Success: #
StatusCode: #
200 (OK)
Contents: #
{
status: "<user status>",
createdAt: "<creation date in UTC>",
updatedAt: "<last updated date in UTC>"
handle: "<user handle>",
userName: "<user name>",
twoFactorPhoneVerification: "<two factor phone verification true or false>",
twoFactorGoogleVerification: "<two factor google verification true or false>",
appId: "<app id>",
phone: "<phone number>",
phoneVerified: "<phone verified true or false>",
metaData: "<user meta data object>",
locale: <user locale e.g. 'EN'>,
lastLogin: "<date of last login in UTC>",
loginProvider: "<'email' | 'apple' | 'google'>",
}
Error: #
StatusCode: #
400 (BAD REQUEST)
500 (INTERNAL SERVER ERROR)
Content: #
{
code: "<internal error code>",
message: "<readable error description>"
}
The internal codes are integers:
- 401 - app no longer exists
- 402 - app is suspended
- 403 - missing parameter
- 404 - user account is suspended
- 405 - invalid access token
- 413 - app is migrated
- 500 - internal server error
- 602 - invalid data