Skip to main content
Set Password
Sets an initial password for the currently authenticated user. This is for accounts that signed up through OAuth (or an external identity) and have no password yet — for example, so they can later sign in with email and password, or unlink their last OAuth identity without being locked out. Requires the user’s own access token in the Authorization header; a service key is refused (403 auth/user-token-required).
This endpoint is only for users who do not already have a password. If the user already has one, use Change Password instead, which verifies the current password before changing it.

Headers

string
required
Bearer {accessToken} — a valid access token for the authenticated user. A service key is refused.

Body Parameters

string
required
The password to set for the account.

Response

204 No Content on success, with no body.

Error Responses

Returned when the user already has a password. Use Change Password instead.
The access token is still valid, but its session no longer exists (signed out, password reset, or the account was claimed by a provider sign-in after its email went unverified). Adding a password needs a live session, so sign in again.
A service key called this endpoint, with or without actingUserId. It needs the signed-in user’s own access token.
A user token, or a request with no credentials, sent actingUserId, even naming its own user. A user token always acts as its own user. (A service key gets the 403 above instead.)
The request sent userId, in the body or the query. These endpoints always act as the signed-in user, so there is no user to name.

See Also