Click Application setup details.
Copy the apiKey
field.
Note that HTTPS is required for all API calls.
You can exchange a custom Auth token for an ID and refresh token by issuing an HTTP POST
request to the signInWithCustomToken
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
token | string | An Identity Platform custom token from which to create an ID and refresh token pair. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. Should always be true. |
tenantId | string | The tenant ID the user is signing into. Only used in multi-tenancy. Must match the tenant_id in the token. |
Property | Name | Description |
---|---|---|
alg | Algorithm | Should be RS256 . |
iss | Issuer | Your project's service account email address. |
sub | Subject | Your project's service account email address. |
aud | Audience | https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit |
iat | Issued-at time | The current time, in seconds since the UNIX epoch. |
exp | Expiration time | The time, in seconds since the UNIX epoch, at which the token expires. It can be a maximum of 3600 seconds later than the iat . Note: this only controls the time when the custom token itself expires. But once you sign a user in using signInWithCustomToken() , they will remain signed in into the device until their session is invalidated or the user signs out. |
uid | User Id | The unique identifier of the user, between 1-36 characters long. |
tenant_id | Tenant Id | The identifier of the tenant that the user is signing in to. |
claims (optional) | Optional custom claims to include in the Security Rules auth or request.auth variables. |
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token generated from the provided custom token. |
refreshToken | string | An Identity Platform refresh token generated from the provided custom token. |
expiresIn | string | The number of seconds in which the ID token expires. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the custom token.
Sample response
{"idToken":"[ID_TOKEN]","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600"}
Common error codes
You can refresh an Identity Platform ID token by issuing an HTTP POST
request to the securetoken.googleapis.com
endpoint.
Method: POST
Content-Type: application/x-www-form-urlencoded
Endpointhttps://securetoken.googleapis.com/v1/token?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
grant_type | string | The refresh token's grant type, always "refresh_token". |
refresh_token | string | An Identity Platform refresh token. |
Property Name | Type | Description |
---|---|---|
expires_in | string | The number of seconds in which the ID token expires. |
token_type | string | The type of the refresh token, always "Bearer". |
refresh_token | string | The Identity Platform refresh token provided in the request or a new refresh token. |
id_token | string | An Identity Platform ID token. |
user_id | string | The uid corresponding to the provided ID token. |
project_id | string | Your Google Cloud project ID. |
Sample request
curl'https://securetoken.googleapis.com/v1/token?key=[API_KEY]'\ -H'Content-Type: application/x-www-form-urlencoded'\ --data'grant_type=refresh_token&refresh_token=[REFRESH_TOKEN]'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the new Identity Platform ID token and refresh token.
Sample response
{"expires_in":"3600","token_type":"Bearer","refresh_token":"[REFRESH_TOKEN]","id_token":"[ID_TOKEN]","user_id":"tRcfmLH7o2XrNELi...","project_id":"1234567890"}
Common error codes
You can create a new email and password user by issuing an HTTP POST
request to the Auth signupNewUser
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
string | The email for the user to create. | |
password | string | The password for the user to create. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. Should always be true. |
tenantId | string | The tenant ID of the user to create. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token for the newly created user. |
string | The email for the newly created user. | |
refreshToken | string | An Identity Platform refresh token for the newly created user. |
expiresIn | string | The number of seconds in which the ID token expires. |
localId | string | The uid of the newly created user. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"email":"[user@example.com]","password":"[PASSWORD]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the new account.
Sample response
{"idToken":"[ID_TOKEN]","email":"[user@example.com]","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","localId":"tRcfmLH7..."}
Common error codes
You can sign in a user with an email and password by issuing an HTTP POST
request to the Auth verifyPassword
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
string | The email the user is signing in with. | |
password | string | The password for the account. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. Should always be true. |
tenantId | string | The tenant ID the user is signing into. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token for the authenticated user. |
string | The email for the authenticated user. | |
refreshToken | string | An Identity Platform refresh token for the authenticated user. |
expiresIn | string | The number of seconds in which the ID token expires. |
localId | string | The uid of the authenticated user. |
registered | boolean | Whether the email is for an existing account. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"email":"[user@example.com]","password":"[PASSWORD]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the existing email/password account.
Sample response
{"localId":"ZY1rJK0eYLg...","email":"[user@example.com]","displayName":"","idToken":"[ID_TOKEN]","registered":true,"refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600"}
Common error codes
You can sign in a user anonymously by issuing an HTTP POST
request to the Auth signupNewUser
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
returnSecureToken | boolean | Whether or not to return an ID and refresh token. Should always be true. |
tenantId | string | The tenant ID the user is signing into. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token for the newly created user. |
string | Since the user is anonymous, this should be empty. | |
refreshToken | string | An Identity Platform refresh token for the newly created user. |
expiresIn | string | The number of seconds in which the ID token expires. |
localId | string | The uid of the newly created user. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]'\ -H'Content-Type: application/json'--data-binary'{"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the anonymous user.
Sample response
{"idToken":"[ID_TOKEN]","email":"","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","localId":"Jws4SVjpT..."}
Common error codes
You can sign in a user with an OAuth credential by issuing an HTTP POST
request to the Auth verifyAssertion
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
requestUri | string | The URI to which the IDP redirects the user back. |
postBody | string | Contains the OAuth credential (an ID token or access token) and provider ID which issues the credential. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. Should always be true. |
returnIdpCredential | boolean | Whether to force the return of the OAuth credential on the following errors: FEDERATED_USER_ID_ALREADY_LINKED and EMAIL_EXISTS. |
tenantId | string | The tenant ID the user is signing into. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
federatedId | string | The unique ID identifies the IdP account. |
providerId | string | The linked provider ID (e.g. "google.com" for the Google provider). |
localId | string | The uid of the authenticated user. |
emailVerified | boolean | Whether the sign-in email is verified. |
string | The email of the account. | |
oauthIdToken | string | The OIDC id token if available. |
oauthAccessToken | string | The OAuth access token if available. |
oauthTokenSecret | string | The OAuth 1.0 token secret if available. |
rawUserInfo | string | The stringified JSON response containing all the IdP data corresponding to the provided OAuth credential. |
firstName | string | The first name for the account. |
lastName | string | The last name for the account. |
fullName | string | The full name for the account. |
displayName | string | The display name for the account. |
photoUrl | string | The photo Url for the account. |
idToken | string | An Identity Platform ID token for the authenticated user. |
refreshToken | string | An Identity Platform refresh token for the authenticated user. |
expiresIn | string | The number of seconds in which the ID token expires. |
needConfirmation | boolean | Whether another account with the same credential already exists. The user will need to sign in to the original account and then link the current credential to it. |
Sample request with OAuth ID token
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"postBody":"id_token=[GOOGLE_ID_TOKEN]&providerId=[google.com]","requestUri":"[http://localhost]","returnIdpCredential":true,"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response with OAuth ID token
{"federatedId":"https://accounts.google.com/1234567890","providerId":"google.com","localId":"5xwsPCWYo...","emailVerified":true,"email":"user@example.com","oauthIdToken":"[GOOGLE_ID_TOKEN]","firstName":"John","lastName":"Doe","fullName":"John Doe","displayName":"John Doe","idToken":"[ID_TOKEN]","photoUrl":"https://lh5.googleusercontent.com/.../photo.jpg","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","rawUserInfo":"{\"updated_time\":\"2017-02-22T01:10:57+0000\",\"gender\":\"male\", ...}"}
Sample request with OAuth access token
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"postBody":"access_token=[FACEBOOK_ACCESS_TOKEN]&providerId=[facebook.com]","requestUri":"[http://localhost]","returnIdpCredential":true,"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response with OAuth access token
{"federatedId":"http://facebook.com/1234567890","providerId":"facebook.com","localId":"5xwsPCWYo...","emailVerified":true,"email":"user@example.com","oauthAccessToken":"[FACEBOOK_ACCESS_TOKEN]","firstName":"John","lastName":"Doe","fullName":"John Doe","displayName":"John Doe","idToken":"[ID_TOKEN]","photoUrl":"https://scontent.xx.fbcdn.net/v/...","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","rawUserInfo":"{\"updated_time\":\"2017-02-22T01:10:57+0000\",\"gender\":\"male\", ...}"}
Sample request with Twitter OAuth 1.0 credential
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"postBody":"access_token=[TWITTER_ACCESS_TOKEN]&oauth_token_secret=[TWITTER_TOKEN_SECRET]&providerId=[twitter.com]","requestUri":"[http://localhost]","returnIdpCredential":true,"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response with Twitter OAuth 1.0 credential
{"federatedId":"http://twitter.com/1234567890", "providerId":"twitter.com", "localId":"5xwsPCWYo...", "emailVerified":true, "email":"user@example.com", "oauthAccessToken":"[OAUTH_ACCESS_TOKEN]", "oauthTokenSecret":"[OAUTH_TOKEN_SECRET]", "firstName":"John", "lastName":"Doe", "fullName":"John Doe", "displayName":"John Doe", "idToken":"[ID_TOKEN]", "photoUrl":"http://abs.twimg.com/sticky/...", "refreshToken":"[REFRESH_TOKEN]", "expiresIn":"3600", "rawUserInfo":"{\"updated_time\":\"2017-02-22T01:10:57+0000\",\"gender\":\"male\", ...}"}
Common error codes
You can look all providers associated with a specified email by issuing an HTTP POST
request to the Auth createAuthUri
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:createAuthUri?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
identifier | string | User's email address |
continueUri | string | The URI to which the IDP redirects the user back. For this use case, this is just the current URL. |
tenantId | string | The tenant ID the user is signing into. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
allProviders | List of strings | The list of providers that the user has previously signed in with. |
registered | boolean | Whether the email is for an existing account |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:createAuthUri?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"identifier":"[user@example.com]","continueUri":"[http://localhost:8080/app]"}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the list of providers associated with the email.
Sample response
{"allProviders":["password","google.com"],"registered":true}
Common error codes
You can send a password reset email by issuing an HTTP POST
request to the Auth getOobConfirmationCode
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]
Property Name | Description |
---|---|
X-Firebase-Locale | The language code corresponding to the user's locale. Passing this will localize the password reset email sent to the user. |
Property Name | Type | Description |
---|---|---|
requestType | string | The kind of OOB code to return. Should be "PASSWORD_RESET" for password reset. |
string | User's email address. | |
tenantId | string | The tenant ID of the user requesting password reset. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
string | User's email address. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"requestType":"PASSWORD_RESET","email":"[user@example.com]"}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"email":"[user@example.com]"}
Common error codes
You can verify a password reset code by issuing an HTTP POST
request to the Auth resetPassword
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:resetPassword?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
oobCode | string | The email action code sent to the user's email for resetting the password. |
tenantId | string | The tenant ID of the user requesting password reset. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
string | User's email address. | |
requestType | string | Type of the email action code. Should be "PASSWORD_RESET". |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:resetPassword?key=[API_KEY]'\ -H'Content-Type: application/json'--data-binary'{"oobCode":"[PASSWORD_RESET_CODE]"}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"email":"[user@example.com]","requestType":"PASSWORD_RESET"}
Common error codes
You can apply a password reset change by issuing an HTTP POST
request to the Auth resetPassword
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:resetPassword?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
oobCode | string | The email action code sent to the user's email for resetting the password. |
newPassword | string | The user's new password. |
tenantId | string | The tenant ID of the user requesting password reset. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
string | User's email address. | |
requestType | string | Type of the email action code. Should be "PASSWORD_RESET". |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:resetPassword?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"oobCode":"[PASSWORD_RESET_CODE]","newPassword":"[NEW_PASSWORD]"}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"email":"[user@example.com]","requestType":"PASSWORD_RESET"}
Common error codes
You can change a user's email by issuing an HTTP POST
request to the Auth setAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]
Property Name | Description |
---|---|
X-Firebase-Locale | The language code corresponding to the user's locale. Passing this will localize the email change revocation sent to the user. |
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token for the user. |
string | The user's new email. | |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. |
Property Name | Type | Description |
---|---|---|
localId | string | The uid of the current user. |
string | User's email address. | |
passwordHash | string | Hash version of the password. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
idToken | string | New Identity Platform ID token for user. |
refreshToken | string | An Identity Platform refresh token. |
expiresIn | string | The number of seconds in which the ID token expires. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary\'{"idToken":"[GCIP_ID_TOKEN]","email":"[user@example2.com]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the new Identity Platform ID token and refresh token associated with the user.
Sample response
{"localId":"tRcfmLH7o2...","email":"[user@example2.com]","passwordHash":"...","providerUserInfo":[{"providerId":"password","federatedId":"[user@example2.com]"}],"idToken":"[NEW_ID_TOKEN]","refreshToken":"[NEW_REFRESH_TOKEN]","expiresIn":"3600"}
Common error codes
You can change a user's password by issuing an HTTP POST
request to the Auth setAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token for the user. |
password | string | User's new password. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. |
Property Name | Type | Description |
---|---|---|
localId | string | The uid of the current user. |
string | User's email address. | |
passwordHash | string | Hash version of password. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
idToken | string | New Identity Platform ID token for user. |
refreshToken | string | An Identity Platform refresh token. |
expiresIn | string | The number of seconds in which the ID token expires. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary\'{"idToken":"[GCIP_ID_TOKEN]","password":"[NEW_PASSWORD]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the new Identity Platform ID token and refresh token associated with the user.
Sample response
{"localId":"tRcfmLH7o2...","email":"[user@example.com]","passwordHash":"...","providerUserInfo":[{"providerId":"password","federatedId":"[user@example.com]"}],"idToken":"[NEW_ID_TOKEN]","refreshToken":"[NEW_REFRESH_TOKEN]","expiresIn":"3600"}
Common error codes
You can update a user's profile (display name / photo URL) by issuing an HTTP POST
request to the Auth setAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | An Identity Platform ID token for the user. |
displayName | string | User's new display name. |
photoUrl | string | User's new photo url. |
deleteAttribute | List of strings | List of attributes to delete, "DISPLAY_NAME" or "PHOTO_URL". This will nullify these values. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. |
Property Name | Type | Description |
---|---|---|
localId | string | The uid of the current user. |
string | User's email address. | |
displayName | string | User's new display name. |
photoUrl | string | User's new photo url. |
passwordHash | string | Hash version of password. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
idToken | string | New Identity Platform ID token for user. |
refreshToken | string | An Identity Platform refresh token. |
expiresIn | string | The number of seconds in which the ID token expires. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary\'{"idToken":"[ID_TOKEN]","displayName":"[NAME]","photoUrl":"[URL]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"localId":"tRcfmLH...","email":"user@example2.com","displayName":"John Doe","photoUrl":"[http://localhost:8080/img1234567890/photo.png]","passwordHash":"...","providerUserInfo":[{"providerId":"password","federatedId":"user@example2.com","displayName":"John Doe","photoUrl":"http://localhost:8080/img1234567890/photo.png"}],"idToken":"[NEW_ID_TOKEN]","refreshToken":"[NEW_REFRESH_TOKEN]","expiresIn":"3600"}
Common error codes
You can get a user's data by issuing an HTTP POST
request to the Auth getAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:lookup?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | The Identity Platform ID token of the account. |
Property Name | Type | Description |
---|---|---|
users | List of JSON objects | The account associated with the given Identity Platform ID token. Check below for more details. |
users
array content)Property Name | Type | Description |
---|---|---|
localId | string | The uid of the current user. |
string | The email of the account. | |
emailVerified | boolean | Whether or not the account's email has been verified. |
displayName | string | The display name for the account. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
photoUrl | string | The photo Url for the account. |
passwordHash | string | Hash version of password. |
passwordUpdatedAt | double | The timestamp, in milliseconds, that the account password was last changed. |
validSince | string | The timestamp, in seconds, which marks a boundary, before which Identity Platform ID tokens are considered revoked. |
disabled | boolean | Whether the account is disabled or not. |
lastLoginAt | string | The timestamp, in milliseconds, that the account last logged in at. |
createdAt | string | The timestamp, in milliseconds, that the account was created at. |
customAuth | boolean | Whether the account is authenticated by the developer. |
tenantId | string | The tenant ID of the user. Only returned in multi-tenancy. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=[API_KEY]'\ -H'Content-Type: application/json'--data-binary'{"idToken":"[GCIP_ID_TOKEN]"}'
A successful request is indicated by a 200 OK
HTTP status code. The response will contain all the user information associated with the account.
Sample response
{"users":[{"localId":"ZY1rJK0...","email":"user@example.com","emailVerified":false,"displayName":"John Doe","providerUserInfo":[{"providerId":"password","displayName":"John Doe","photoUrl":"http://localhost:8080/img1234567890/photo.png","federatedId":"user@example.com","email":"user@example.com","rawId":"user@example.com","screenName":"user@example.com"}],"photoUrl":"https://lh5.googleusercontent.com/.../photo.jpg","passwordHash":"...","passwordUpdatedAt":1.484124177E12,"validSince":"1484124177","disabled":false,"lastLoginAt":"1484628946000","createdAt":"1484124142000","customAuth":false}]}
Common error codes
You can link an email/password to a current user by issuing an HTTP POST
request to the Auth setAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | The Identity Platform ID token of the account you are trying to link the credential to. |
string | The email to link to the account. | |
password | string | The new password of the account. |
returnSecureToken | string | Whether or not to return an ID and refresh token. Should always be true. |
Property Name | Type | Description |
---|---|---|
localId | string | The uid of the current user. |
string | The email of the account. | |
displayName | string | The display name for the account. |
photoUrl | string | The photo Url for the account. |
passwordHash | string | Hash version of password. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
emailVerified | boolean | Whether or not the account's email has been verified. |
idToken | string | New Identity Platform ID token for user. |
refreshToken | string | An Identity Platform refresh token. |
expiresIn | string | The number of seconds in which the ID token expires. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary\'{"idToken":"[ID_TOKEN]","email":"[user@example.com]","password":"[PASS]","returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response
{"localId":"huDwUz...","email":"user@example.com","displayName":"John Doe","photoUrl":"https://lh5.googleusercontent.com/.../photo.jpg","passwordHash":"...","providerUserInfo":[{"providerId":"password","federatedId":"user@example.com"}],"idToken":"[ID_TOKEN]","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","emailVerified":false}
Common error codes
You can link an OAuth credential to a user by issuing an HTTP POST
request to the Auth verifyAssertion
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | The Identity Platform ID token of the account you are trying to link the credential to. |
requestUri | string | The URI to which the IDP redirects the user back. |
postBody | string | Contains the OAuth credential (an ID token or access token) and provider ID which issues the credential. |
returnSecureToken | boolean | Whether or not to return an ID and refresh token. Should always be true. |
returnIdpCredential | boolean | Whether to force the return of the OAuth credential on the following errors: FEDERATED_USER_ID_ALREADY_LINKED and EMAIL_EXISTS. |
Property Name | Type | Description |
---|---|---|
federatedId | string | The unique ID identifies the IdP account. |
providerId | string | The linked provider ID (e.g. "google.com" for the Google provider). |
localId | string | The uid of the authenticated user. |
emailVerified | boolean | Whether the signin email is verified. |
string | The email of the account. | |
oauthIdToken | string | The OIDC id token if available. |
oauthAccessToken | string | The OAuth access token if available. |
oauthTokenSecret | string | The OAuth 1.0 token secret if available. |
rawUserInfo | string | The stringified JSON response containing all the IdP data corresponding to the provided OAuth credential. |
firstName | string | The first name for the account. |
lastName | string | The last name for the account. |
fullName | string | The full name for the account. |
displayName | string | The display name for the account. |
photoUrl | string | The photo Url for the account. |
idToken | string | An Identity Platform ID token for the authenticated user. |
refreshToken | string | An Identity Platform refresh token for the authenticated user. |
expiresIn | string | The number of seconds in which the ID token expires. |
Sample request with OAuth ID token
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"postBody":"id_token=[GOOGLE_ID_TOKEN]&providerId=[google.com]","requestUri":"[http://localhost]","idToken":"[GCIP_ID_TOKEN]","returnIdpCredential":true,"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response with OAuth ID token
{"federatedId":"https://accounts.google.com/1234567890","providerId":"google.com","localId":"5xwsPCWYo...","emailVerified":true,"email":"user@example.com","oauthIdToken":"[GOOGLE_ID_TOKEN]","firstName":"John","lastName":"Doe","fullName":"John Doe","displayName":"John Doe","idToken":"[ID_TOKEN]","photoUrl":"https://lh5.googleusercontent.com/.../photo.jpg","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","rawUserInfo":"{\"updated_time\":\"2017-02-22T01:10:57+0000\",\"gender\":\"male\", ...}"}
Sample request with OAuth access token
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"postBody":"access_token=[FACEBOOK_ACCESS_TOKEN]&providerId=[facebook.com]","idToken":"[GCIP_ID_TOKEN]","requestUri":"[http://localhost]","returnIdpCredential":true,"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response with OAuth access token
{"federatedId":"http://facebook.com/1234567890","providerId":"facebook.com","localId":"5xwsPCWYo...","emailVerified":true,"email":"user@example.com","oauthAccessToken":"[FACEBOOK_ACCESS_TOKEN]","firstName":"John","lastName":"Doe","fullName":"John Doe","displayName":"John Doe","idToken":"[ID_TOKEN]","photoUrl":"https://scontent.xx.fbcdn.net/v/...","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","rawUserInfo":"{\"updated_time\":\"2017-02-22T01:10:57+0000\",\"gender\":\"male\", ...}"}
Sample request with Twitter OAuth 1.0 credential
curl'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"postBody":"access_token=[TWITTER_ACCESS_TOKEN]&oauth_token_secret=[TWITTER_TOKEN_SECRET]&providerId=[twitter.com]","requestUri":"[http://localhost]","idToken":"[GCIP_ID_TOKEN]","returnIdpCredential":true,"returnSecureToken":true}'
A successful request is indicated by a 200 OK
HTTP status code. The response contains the Identity Platform ID token and refresh token associated with the authenticated user.
Sample response with Twitter OAuth 1.0 credential
{"federatedId":"http://twitter.com/1234567890","providerId":"twitter.com","localId":"5xwsPCWYo...","emailVerified":true,"email":"user@example.com","oauthAccessToken":"[OAUTH_ACCESS_TOKEN]","oauthTokenSecret":"[OAUTH_TOKEN_SECRET]","firstName":"John","lastName":"Doe","fullName":"John Doe","displayName":"John Doe","idToken":"[ID_TOKEN]","photoUrl":"http://abs.twimg.com/sticky/...","refreshToken":"[REFRESH_TOKEN]","expiresIn":"3600","rawUserInfo":"{\"updated_time\":\"2017-02-22T01:10:57+0000\",\"gender\":\"male\", ...}"}
Common error codes
You can unlink a provider from a current user by issuing an HTTP POST
request to the Auth setAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | The Identity Platform ID token of the account. |
deleteProvider | List of strings | The list of provider IDs to unlink, eg: 'google.com', 'password', etc. |
Property Name | Type | Description |
---|---|---|
localId | string | The uid of the current user. |
string | The email of the account. | |
displayName | string | The display name for the account. |
photoUrl | string | The photo Url for the account. |
passwordHash | string | Hash version of the password. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
emailVerified | boolean | Whether or not the account's email has been verified. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"idToken":"[GCIP_ID_TOKEN]","deleteProvider":["[facebook.com]"]}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"localId":"huDwUz...","email":"user@example.com","displayName":"John Doe","photoUrl":"https://lh5.googleusercontent.com/.../photo.jpg","passwordHash":"...","providerUserInfo":[{"providerId":"google.com","federatedId":"1234567890","displayName":"John Doe","photoUrl":"https://lh5.googleusercontent.com/.../photo.jpg"},{"providerId":"password","federatedId":"user@example.com"}],"emailVerified":"true"}
Common error codes
You can send an email verification for the current user by issuing an HTTP POST
request to the Auth getOobConfirmationCode
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]
Property Name | Description |
---|---|
X-Firebase-Locale | The language code corresponding to the user's locale. Passing this will localize the email verification sent to the user. |
Property Name | Type | Description |
---|---|---|
requestType | string | The type of confirmation code to send. Should always be "VERIFY_EMAIL". |
idToken | string | The Identity Platform ID token of the user to verify. |
Property Name | Type | Description |
---|---|---|
string | The email of the account. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]'\ -H'Content-Type: application/json'\ --data-binary'{"requestType":"VERIFY_EMAIL","idToken":"[GCIP_ID_TOKEN]"}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"email":"user@example.com"}
Common error codes
You can confirm an email verification code by issuing an HTTP POST
request to the Auth setAccountInfo
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
oobCode | string | The action code sent to user's email for email verification. |
tenantId | string | The tenant ID of the user verifying the email. Only used in multi-tenancy. |
Property Name | Type | Description |
---|---|---|
string | The email of the account. | |
displayName | string | The display name for the account. |
photoUrl | string | The photo Url for the account. |
passwordHash | string | The password hash. |
providerUserInfo | List of JSON objects | List of all linked provider objects which contain "providerId" and "federatedId". |
emailVerified | boolean | Whether or not the account's email has been verified. |
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]'\ -H'Content-Type: application/json'--data-binary'{"oobCode":"[VERIFICATION_CODE]"}'
A successful request is indicated by a 200 OK
HTTP status code.
Sample response
{"localId":"FhyStE...","email":"user@example.com","passwordHash":"...","providerUserInfo":[{"providerId":"password","federatedId":"user@example.com"}]}
Common error codes
You can delete a current user by issuing an HTTP POST
request to the Auth deleteAccount
endpoint.
Method: POST
Content-Type: application/json
Endpointhttps://identitytoolkit.googleapis.com/v1/accounts:delete?key=[API_KEY]
Property Name | Type | Description |
---|---|---|
idToken | string | The Identity Platform ID token of the user to delete. |
Property Name | Type | Description |
---|
Sample request
curl'https://identitytoolkit.googleapis.com/v1/accounts:delete?key=[API_KEY]'\ -H'Content-Type: application/json'--data-binary'{"idToken":"[GCIP_ID_TOKEN]"}'
A successful request is indicated by a 200 OK
HTTP status code.
Common error codes
The following is an example of a common error returned by Identity Platform:
{ "error": { "errors": [ { "domain": "global", "reason": "invalid", "message": "CREDENTIAL_TOO_OLD_LOGIN_AGAIN" } ], "code": 400, "message": "CREDENTIAL_TOO_OLD_LOGIN_AGAIN" } }
Obtain the error code from the message
field.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-17 UTC.