> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/how-the-apps-work/screens/account/login-code.md).

# Login code

{% hint style="info" %}
Draft, written by an agent and not yet checked by a person ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). Platforms: web and iOS. [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/screens/account/login-code.md).
{% endhint %}

Enter the one-time code sent by email or SMS to sign in without a password.

* **Where:** web: the code step of the mini sign-in dialog, on top of the app (the code step of the [Sign in](https://docs.snapfix.com/how-the-apps-work/screens/account/sign-in.md) component). The sign-in page itself never shows this step \[[ASK-65](https://github.com/snapfix/docs/blob/main/ASK.md#ask-65-is-sign-in-with-a-one-time-code-meant-to-be-gone-from-the-sign-in-screens)]. iOS: `SmsEmailOtpVC`, which no current path opens (see [Platform differences](#platform-differences)). Android has no code step on sign-in; its code screen is [Forgot password code](https://docs.snapfix.com/how-the-apps-work/screens/account/forgot-password-code.md).
* **Who:** web: a signed-in password user whose session can no longer be renewed (`login_src` `snapfix`), or a user deleting the profile. The dialog cannot be dismissed.
* **Feature:** [Sign-in](https://docs.snapfix.com/product/features/account/sign-in.md)

Not checked live: the dialog sends a code as soon as it opens, and the live pass does not send codes \[[ASK-30](https://github.com/snapfix/docs/blob/main/ASK.md#ask-30-can-the-live-pass-reach-the-code-and-link-screens)]. The layout below is from code.

## Layout

### Web

A 365-pixel dialog. It opens on the code step, with the contact taken from the stored user, and sends the code 0.2 seconds after it opens. Top to bottom:

1. "Enter email code to log in" or "Enter SMS code to log in", from the saved login type.
2. For email: "An email has been sent to:" and the masked address, then "This email is valid for 5 minutes" and "Make sure to check your spam folder". The mask keeps the first character of the name, the first character of the domain and the last character of the suffix, and shows every other character as `*` (`j***@e******.**m`). For a phone: "An SMS has been sent to phone number ending in:" and the last four digits, then "This SMS is valid for 5 minutes".
3. One code field, shown as six spaced places (`- - - - -`).
4. "Resend code", or "Resend code (30)" while the countdown runs.
5. "Log In".
6. "Use password", "OR" and "Log out".

The component also has a "Send me a one-time password code" button, labelled "Email not verified" or "Phone number not verified" for an unverified contact. It shows only before a code is sent, which never happens on the sign-in page and is skipped in the dialog.

### iOS

The screen `SmsEmailOtpVC` would show a progress bar, "Enter email code to log in" or "Enter SMS code to log in", "An email has been sent to" or "A SMS text message has been send to" with the full address or number, the validity note, a six-character field that offers the phone's one-time code autofill, "Resend code" with "You can resend a one-time code in 30 seconds." while it is off, and a log-in button. Nothing opens it today \[[ASK-65](https://github.com/snapfix/docs/blob/main/ASK.md#ask-65-is-sign-in-with-a-one-time-code-meant-to-be-gone-from-the-sign-in-screens)].

## Inputs

| Field | Type                 | Required | Default | Rules and messages                                                                                                                                                                                                                                                                                                                                                                                  |
| ----- | -------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Code  | Text, six characters | Yes      | Empty   | Web: the mask does not check the characters, and "Log In" is disabled while the field is empty (any length is sent). The code's empty-field alert ("Enter email code to log in" or "Enter SMS code to log in") cannot be reached, because the button is disabled. iOS: the button is on only for six characters with no letter; a rejected code shows "This code is not correct, please try again." |

## Actions

| Action               | Who                 | What happens                                                                                                                                                                                                                                                                                                                                                                                                              | API                                                                                            |
| -------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| Send the code (web)  | The dialog, on open | Sends the saved login's email, or the phone only when it is verified, with the header `note` `mini-login`. The contact is treated as verified even when the saved type is phone and the phone is not verified, so the request can go with an empty number. A failed answer shows the server's message.                                                                                                                    | [`POST /login-with-otp`](https://docs.snapfix.com/engineering-reference/api/auth.md) on authpy |
| "Log In" (web)       | The dialog's user   | Checks the code with the reference ID from the send. On success the button shows its success state for 1.5 seconds and the session is stored. During a profile deletion the dialog then closes so the delete can go on ([My profile](https://docs.snapfix.com/how-the-apps-work/screens/account/profile.md)); otherwise the page reloads. A wrong code shows the server's message in the shared alert and keeps the code. | [`POST /verify-otp`](https://docs.snapfix.com/engineering-reference/api/auth.md)               |
| "Resend code" (web)  | The dialog's user   | Off for 30 seconds after each send. Sends a new code to the same contact and shows the server's message, or "An message has been sent", in an alert for five seconds.                                                                                                                                                                                                                                                     | [`POST /login-with-otp`](https://docs.snapfix.com/engineering-reference/api/auth.md)           |
| "Use password" (web) | The dialog's user   | Shows the password step of [Sign in](https://docs.snapfix.com/how-the-apps-work/screens/account/sign-in.md#dialogs-and-sheets) in the dialog.                                                                                                                                                                                                                                                                             | -                                                                                              |
| "Log out" (web)      | The dialog's user   | Logs out and closes the dialog.                                                                                                                                                                                                                                                                                                                                                                                           | -                                                                                              |
| "Resend code" (iOS)  | -                   | Would send a new code (`send_via` `sms`, also for email) and restart the 30-second countdown.                                                                                                                                                                                                                                                                                                                             | [`POST /resend-otp`](https://docs.snapfix.com/engineering-reference/api/auth.md)               |

## States

* **Loading:** web: "Log In" spins while the code is checked, and "Resend code" shows a spinner while a code is sent.
* **Empty:** "Log In" is disabled until the field has a value.
* **Error:** web: the server's message in the shared alert; the button returns to idle.
* **No permission:** no role check. The dialog opens only for a Snapfix login; any other login source is logged out instead.
* **Offline (mobile):** not applicable on the web; the requests fail and the shared alert shows.

## Dialogs and sheets

The web step is itself the mini sign-in dialog ([Sign in](https://docs.snapfix.com/how-the-apps-work/screens/account/sign-in.md#dialogs-and-sheets)). It opens when the interceptor cannot renew the session, and from the profile delete.

## Platform differences

* **Where the step starts.** On the web it runs only in the mini sign-in dialog. On iOS the control that opens `SmsEmailOtpVC` ("Log In via Email", `onPressedSendCodeVia`) is wired only in the `SmsEmailLoginSB.storyboard` copy of the sign-in screen. The app builds the sign-in screen from `OnBoarding.storyboard`, which has no such control, so iOS users cannot sign in with a code from the sign-in screen \[[ASK-65](https://github.com/snapfix/docs/blob/main/ASK.md#ask-65-is-sign-in-with-a-one-time-code-meant-to-be-gone-from-the-sign-in-screens)]. Android has no code step on sign-in.
* **Contact shown.** The web masks the email and shows the last four digits of a phone. iOS would show the full address or number.
* **Code characters.** The web accepts any characters; iOS accepts six with no letter. The server's codes are six digits.
* **Autofill.** The web field offers no one-time code autofill; the iOS field does.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/how-the-apps-work/screens/account/login-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
