Skip to main content

sdk.asUser(idToken).Profile()

Read and change the profile of the signed-in user. Only available on the user context, because the profile belongs to the person, not the app.

const profile = sdk.asUser(idToken).Profile()

get()​

GET /api/v1/profile

const { result } = await profile.get()
// { tenantId, tenantName, uid, displayName, photoURL, emailHint: '*****@example.com' }

The email is masked.

update(displayName)​

PUT /api/v1/updateProfile with { displayName }. Result { result: 'ok' }.

setAvatar(photoURL)​

POST /api/v1/avatar with { photoURL }. Upload the image first with the Files service, then pass its URL.

requestPasswordReset()​

POST /api/v1/requestPasswordReset. Sends the reset email to the address of the user. No parameters.

delete(password)​

DELETE /api/v1/profile with { password }.

Deletes the account by anonymising it: the email becomes deleted_<uid>@anon.local, the status deactivated, and journal and system events are anonymised.

ErrorMeaning
auth/password-required (400)No password sent
auth/wrong-password (401)Wrong password

Errors of the other calls​

profile/invalid (401), profile/user-not-active, profile/not-active.