# Method: accounts.signInWithPassword

- [HTTP request](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#body.HTTP_TEMPLATE)
- [Request body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#body.SignInWithPasswordResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#body.aspect)
- [UserNotification](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#UserNotification)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#UserNotification.SCHEMA_REPRESENTATION)
- [NotificationCode](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#NotificationCode)
- [Try it!](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#try-it)

Signs in a user with email and password. If the sign-in succeeds, a new Identity Platform ID token and refresh token are issued for the authenticated user.

An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.

### HTTP request

`POST https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "email": string, "password": string, "pendingIdToken": string, "captchaChallenge": string, "captchaResponse": string, "instanceId": string, "delegatedProjectNumber": string, "idToken": string, "returnSecureToken": boolean, "tenantId": string, "clientType": enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/ClientType`), "recaptchaVersion": enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/RecaptchaVersion`) } ``` |

| Fields ||
|---|---|
| `email` | `string` Required. The email the user is signing in with. The length of email should be less than 256 characters and in the format of `name@domain.tld`. The email should also match the [RFC 822](https://tools.ietf.org/html/rfc822) addr-spec production. |
| `password` | `string` Required. The password the user provides to sign in to the account. |
| `pendingIdToken (deprecated)` | `string` |
| `captchaChallenge (deprecated)` | `string` |
| `captchaResponse` | `string` The reCAPTCHA token provided by the reCAPTCHA client-side integration. reCAPTCHA Enterprise uses it for risk assessment. Required when reCAPTCHA Enterprise is enabled. |
| `instanceId (deprecated)` | `string` |
| `delegatedProjectNumber (deprecated)` | `string (https://developers.google.com/discovery/v1/type-format format)` |
| `idToken (deprecated)` | `string` |
| `returnSecureToken` | `boolean` Should always be true. |
| `tenantId` | `string` The ID of the Identity Platform tenant the user is signing in to. If not set, the user will sign in to the default Identity Platform instance in the project. |
| `clientType` | ``enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/ClientType`)`` The client type, web, android or ios. Required when reCAPTCHA Enterprise is enabled. |
| `recaptchaVersion` | ``enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/RecaptchaVersion`)`` The reCAPTCHA version of the reCAPTCHA token in the captchaResponse. |

### Response body

Response message for accounts.signInWithPassword.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "kind": string, "localId": string, "email": string, "displayName": string, "idToken": string, "registered": boolean, "profilePicture": string, "oauthAccessToken": string, "oauthExpireIn": integer, "oauthAuthorizationCode": string, "refreshToken": string, "expiresIn": string, "mfaPendingCredential": string, "mfaInfo": [ { object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/MfaEnrollment`) } ], "userNotifications": [ { object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#UserNotification`) } ] } ``` |

| Fields ||
|---|---|
| `kind (deprecated)` | `string` > [!WARNING] > This item is deprecated! |
| `localId` | `string` The ID of the authenticated user. Always present in the response. |
| `email` | `string` The email of the authenticated user. Always present in the response. |
| `displayName` | `string` The user's display name stored in the account's attributes. |
| `idToken` | `string` An Identity Platform ID token for the authenticated user. |
| `registered (deprecated)` | `boolean` > [!WARNING] > This item is deprecated! Whether the email is for an existing account. Always true. |
| `profilePicture` | `string` The user's profile picture stored in the account's attributes. |
| `oauthAccessToken (deprecated)` | `string` > [!WARNING] > This item is deprecated! The OAuth2 access token. |
| `oauthExpireIn (deprecated)` | `integer` > [!WARNING] > This item is deprecated! The access token expiration time in seconds. |
| `oauthAuthorizationCode (deprecated)` | `string` > [!WARNING] > This item is deprecated! |
| `refreshToken` | `string` An Identity Platform refresh token for the authenticated user. |
| `expiresIn` | `string (https://developers.google.com/discovery/v1/type-format format)` The number of seconds until the Identity Platform ID token expires. |
| `mfaPendingCredential` | `string` An opaque string that functions as proof that the user has successfully passed the first factor authentication. |
| `mfaInfo[]` | ``object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/MfaEnrollment`)`` Info on which multi-factor authentication providers are enabled for the account. Present if the user needs to complete the sign-in using multi-factor authentication. |
| `userNotifications[]` | ``object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#UserNotification`)`` Warning notifications for the user. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/identitytoolkit`
- `
  https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## UserNotification

Warning notifications for the user.

| JSON representation |
|---|
| ``` { "notificationCode": enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#NotificationCode`), "notificationMessage": string } ``` |

| Fields ||
|---|---|
| `notificationCode` | ``enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithPassword#NotificationCode`)`` Warning notification enum. Can be used for localization. |
| `notificationMessage` | `string` Warning notification string. Can be used as fallback. |

## NotificationCode

Warning notification enum. Can be used for localization.

| Enums ||
|---|---|
| `NOTIFICATION_CODE_UNSPECIFIED` | No notification specified. |
| `MISSING_LOWERCASE_CHARACTER` | Password missing lowercase character. |
| `MISSING_UPPERCASE_CHARACTER` | Password missing uppercase character. |
| `MISSING_NUMERIC_CHARACTER` | Password missing numeric character. |
| `MISSING_NON_ALPHANUMERIC_CHARACTER` | Password missing non alphanumeric character. |
| `MINIMUM_PASSWORD_LENGTH` | Password less than minimum required length. |
| `MAXIMUM_PASSWORD_LENGTH` | Password greater than maximum required length. |