> 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/sign-in.md).

# Sign in

{% 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, iOS and Android. [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/screens/account/sign-in.md).
{% endhint %}

Sign in with an email address or phone number and a password, or with Google, Apple or Microsoft.

* **Where:** web `/auth/sign-in`; iOS and Android: after the walkthrough, after logging out, and from the `/onboarding` and `/opnLogin` deep links.
* **Who:** signed-out users. On the web, the route guard sends a browser that holds a session (access token, refresh token and user data) to `/fix`.
* **Feature:** [Sign-in](https://docs.snapfix.com/product/features/account/sign-in.md)

A forgotten password goes to [Forgot password](https://docs.snapfix.com/how-the-apps-work/screens/account/forgot-password.md). The one-time code step is [Login code](https://docs.snapfix.com/how-the-apps-work/screens/account/login-code.md); neither the web page nor the iOS screen offers it at sign-in (see [Platform differences](#platform-differences)).

![Sign in on the web, empty form](https://3653879137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsVVGa79QbcEkJ7n8srxe%2Fuploads%2Fgit-blob-6018a55ae71b486557a61a3b5b8820c6f17655a3%2Fsign-in.jpg?alt=media)

## Layout

### Web

The form on the left, and on the right a photo, picked at random from three, with the white Snapfix logo. Top to bottom in the form:

1. The Snapfix logo.
2. The title "Sign in".
3. "Login type", with "Email" and "Phone Number". The choice is the last one used in this browser, or "Email" the first time.
4. The field for the chosen type. For email it is labelled "Email" and has the placeholder "Enter your email". For a phone number it is a country picker, which starts on Ireland ("+353"), and a number field with the placeholder "085 012 3456".
5. "Password", with a button that shows the typed text.
6. "Forgot password?".
7. "Login".
8. "OR continue with", then three buttons that show only the Google, Apple and Microsoft logos. They have no text and no accessible name.
9. Under the form: "Having trouble loggin in?" and "HelpHub.".

The page has a separate password step and a code step. Neither is reached from this page: they run in the mini sign-in dialog ([Dialogs and sheets](#dialogs-and-sheets)).

### iOS

The sign-in screen is `SmsEmailLoginVC`, built from `OnBoarding.storyboard`. Top to bottom:

1. "Welcome back!" and "Login to Your Account".
2. "Login Type", with "Email" and "Phone number". The screen opens on "Email".
3. The field for the chosen type. For a phone number, a country button with a flag, which starts on the device's region.
4. "Password", with an eye button.
5. "Forgot password?".
6. "LOGIN".
7. "OR Continue with", then Google, Apple and Microsoft buttons. The code that would hide them (`initSSO`) returns on its first line, and the storyboard does not hide this block, so from the code the buttons show and work \[[ASK-64](https://github.com/snapfix/docs/blob/main/ASK.md#ask-64-does-the-ios-sign-in-screen-show-google-apple-and-microsoft)]. A second, hidden block ("Previously logged in with") is never shown.
8. "Snapfix use and transfer to any other app of information received from Google APIs will adhere to Google API Services User Data Policy, including the Limited Use requirements." The policy name opens Google's policy page.
9. "New to Snapfix? Ask your Admin to set up your account."
10. "Having trouble logging in? HelpHub."

The terms checkbox is hidden and treated as ticked. A second sign-in screen, `SmsEmailMainLoginVC` in `SmsEmailLoginSB.storyboard`, has its own layout ("Log In", "Create your Account", and the one-time code control "Log In via Email"), but nothing opens it: its only caller is commented out (`AppDelegate.swift:253`).

### Android

Top to bottom:

1. "Welcome Back!" and "Login to Your Account".
2. "Login Type", with "Email" and "Phone Number". The screen opens on "Email".
3. The field for the chosen type. For a phone number, a country picker on the device region.
4. "Password", "Forgot password?" and "Login".
5. "OR Continue With", then Google, Apple and Microsoft logo buttons. A second Apple button, "Sign in with Apple", is in the layout and hidden; the visible Apple button presses it.
6. The same Google API policy sentence as iOS, with the policy name linked.
7. "New to Snapfix? Ask your Admin to set up your account."
8. "Having a trouble loggin in?" and "HelpHub.".

## Inputs

| Field        | Type                         | Required                    | Default                                                                                                                                                                                                                | Rules and messages                                                                                                                                                                                                                                                                                                                             |
| ------------ | ---------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Login type   | Choice: email or phone       | Yes                         | Web: the last choice, or "Email". iOS and Android: "Email"                                                                                                                                                             | Web: switching keeps what was typed in the other field, and the choice is stored in the browser. iOS and Android: switching clears the field.                                                                                                                                                                                                  |
| Email        | Text                         | Yes, when the type is email | Web: empty, or the value of `tempUsername` in this browser (set after a reset link is sent on [Forgot password](https://docs.snapfix.com/how-the-apps-work/screens/account/forgot-password.md)), which is then cleared | Web: trimmed, up to 70 characters, no format check. An empty email and phone shows "Please enter your email or phone number". iOS: no format check, so any text is sent. Android: "Please enter email or username" when empty, under the field.                                                                                                |
| Phone number | Country code and number      | Yes, when the type is phone | Web: Ireland; the country is not looked up from the network. iOS and Android: the device region                                                                                                                        | Web: the field's own number check; "Login" stays disabled while the number is invalid, and Enter shows "Invalid phone number". iOS: "Please enter valid phone number." when the text has letters, is shorter than four characters, or does not parse for the chosen country. Android: "Please enter valid phone number" when empty or invalid. |
| Password     | Password, with show and hide | Yes                         | Empty                                                                                                                                                                                                                  | Web: up to 128 characters. "Login" is disabled while the field is empty; Enter in the empty field shows "Please enter a password". iOS: fewer than six characters shows "The password must be at least six characters long" under the field, and nothing is sent. Android: "Please enter a valid password" when empty; no minimum length.      |

Web messages show in the shared alert. iOS and Android show theirs under the field. Checked live on the web without submitting: Enter in the empty password field with both fields empty shows "Please enter your email or phone number"; with an email typed it shows "Please enter a password"; with the phone type and "123" it shows "Invalid phone number".

## Actions

| Action                                        | Who                                  | What happens                                                                                                                                                                                                                                                                                                                                                                                            | API                                                                                                                                                                                        |
| --------------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| "Login", or Enter in the password field (web) | Signed-out users                     | Checks the contact and the password, then sends them. The radios are disabled and the button spins while it runs. On success the button shows its success state for 1.5 seconds, the session is stored, the IP lookup runs, and `/fix` opens (the live app then shows `/fix/groups`).                                                                                                                   | [`POST /login`](https://docs.snapfix.com/engineering-reference/api/auth.md) on authpy                                                                                                      |
| Google, Apple or Microsoft (web)              | Signed-out users                     | Google is disabled until its script is ready, and a failed setup retries. Apple asks for name and email. Microsoft asks for `user.read`, `profile`, `email` and `openid`; cancelling does nothing, and any other failure shows "An error occurred while processing your login request". Success stores the session; the app shell then sees it and opens `/fix`, and the IP lookup runs.                | [`POST /sso-google`, `/sso-apple`, `/sso-azure`](https://docs.snapfix.com/engineering-reference/api/auth.md) on authpy                                                                     |
| "LOGIN" (iOS)                                 | Signed-out users                     | Checks the fields and the connection, then checks the username. An access token in that answer means the account has no password yet: the session is stored and [Set password](https://docs.snapfix.com/how-the-apps-work/screens/account/set-password.md) opens. Otherwise the password is checked.                                                                                                    | [`POST /validate-username-v2`](https://docs.snapfix.com/engineering-reference/api/auth.md), then [`?action=check_password_v7`](https://docs.snapfix.com/engineering-reference/api/auth.md) |
| "Login" (Android)                             | Signed-out users                     | Checks the fields and the connection, then checks the username. "email does not exist!" and "mobile does not exist!" show under the field with a capital first letter; any other failure is an alert with the server's message. A temporary password in the answer opens [Set password](https://docs.snapfix.com/how-the-apps-work/screens/account/set-password.md). Otherwise the password is checked. | [`POST /validate-username-v2`](https://docs.snapfix.com/engineering-reference/api/auth.md), then [`?action=check_password_v7`](https://docs.snapfix.com/engineering-reference/api/auth.md) |
| Google, Apple or Microsoft (Android)          | Signed-out users                     | Google and Apple check the connection first; Microsoft does not, and a Microsoft failure is only logged. Success follows the same path as a password sign-in.                                                                                                                                                                                                                                           | [`POST /sso-google`, `/sso-apple`, `/sso-azure`](https://docs.snapfix.com/engineering-reference/api/auth.md)                                                                               |
| "Forgot password?"                            | Anyone                               | Opens [Forgot password](https://docs.snapfix.com/how-the-apps-work/screens/account/forgot-password.md) with the typed email or phone. The web keeps it in the browser for that page.                                                                                                                                                                                                                    | -                                                                                                                                                                                          |
| "HelpHub."                                    | Anyone                               | Web: opens `/auth/help-hub-faq` in the same tab ([Help with logging in](https://docs.snapfix.com/how-the-apps-work/screens/help/login-help.md)); live, its seven items are about rooms, QR codes, multi-select, the account switcher, frozen tasks and chat, not about signing in. iOS: opens the FAQ screen. Android: opens the login help hub.                                                        | Web: `GET /v1/guest/help-hub/faq` ([Help API](https://docs.snapfix.com/engineering-reference/api/help.md))                                                                                 |
| Country code (iOS and Android)                | Anyone, phone type                   | Opens the country list. Choosing a country sets the flag and dial code; on iOS it also clears the number.                                                                                                                                                                                                                                                                                               | -                                                                                                                                                                                          |
| Stored link (Android)                         | Anyone, when a link was opened first | Reads the link stored by the deep-link handler. "user-invitation", "reset\_password" and "verify\_profile" check the username with the link and then follow the temporary-password or signed-in path above. "qrcode-invitation" opens registration. Any other type does nothing.                                                                                                                        | [`GET /dl-ctx`](https://docs.snapfix.com/engineering-reference/api/auth.md), [`POST /validate-username-v3`](https://docs.snapfix.com/engineering-reference/api/auth.md)                    |

### What the web sends and does after "Login"

* The request sends the email as typed and trimmed, or the phone number as its country code without "+" followed by the number, with no spaces or dashes. The password is sent as typed.
* A failed request shows the server's message in the shared alert ([shared behavior](https://docs.snapfix.com/how-the-apps-work/shared.md)); live, a wrong password shows "Invalid credentials". HTTP 409 opens the verification dialog and HTTP 428 the create-password dialog instead of the alert; this is the app-wide interceptor.
* On success the tokens and the user are stored in the browser's local storage.
* After a sign-in, the browser looks up the device's approximate location on a third-party site, with a key from the bundle, and sends it to the start-of-app log. The live pass saw the lookup right after a successful sign-in.
* The page logs Firebase Analytics events: `login_event`, `login_setpwd`, `signin_type_change`, `login_password_forget`, `login_mobile_get_focus`, `login_mobile_lost_focus` and `open_help_hub`.

### What iOS and Android do after the password check

* A wrong password: iOS shows the [Password incorrect](#dialogs-and-sheets) panel when the message contains "incorrect password" or the six-character message. Android shows "Password Incorrect. Please try again or reset your password" under the field for "Incorrect password", and also for "The password must be at least six characters long.".
* A shared phone number: a message containing "duplicate" (iOS) or "user duplicate found" (Android) opens [Confirm phone number](#dialogs-and-sheets).
* Any other failure: iOS shows "Error" and "The username or password is incorrect. " (with the trailing space). Android shows the server's message. A response with no user on Android shows "Something went wrong. Please try again."
* A temporary password on the password answer opens [Set password](https://docs.snapfix.com/how-the-apps-work/screens/account/set-password.md) (Android), or the password-required path opens it (iOS).
* Success: the apps store the user, and also the password, on the device. The same user as last time opens the app; a different user opens [Reloading Snapfix](https://docs.snapfix.com/how-the-apps-work/screens/account/download-data.md). Both apps set "should create business" to 0 whatever the server sends, so the setup flow does not open from here \[[ASK-39](https://github.com/snapfix/docs/blob/main/ASK.md#ask-39-is-the-apps-setup-flow-retired)].

## States

* **Loading:** web: "Login" spins and the radios are disabled; after success the button stays in its success state for 1.5 seconds. iOS: "LOGIN" spins. Android: "Please wait..." during the username check, and "Login" spins during the password check.
* **Empty:** the form is always shown.
* **Error:** web: the server's message in the shared alert, and the button returns to idle. iOS and Android: the messages in [Inputs](#inputs) and [Actions](#actions).
* **No permission:** none; the screen has no role check.
* **Offline (mobile):** iOS "LOGIN" shows "No Connection" and "No internet connection detected. Internet access is required to login."; the iOS Google, Apple and Microsoft buttons show "No Connection" and "You must be connected to the Internet to carry out this task. Please connect and try again." Android "Login", Google and Apple show "You must be connected to the Internet to carry out this task. Please connect and try again." with "OK"; Microsoft does not check. On the web the request fails and the alert shows the failure.

Android also, the first time this screen opens, asks for the pre-registration questions and opens that screen when the request returns them.

## Dialogs and sheets

* **Alerts (web):** "Please enter your email or phone number", "Invalid phone number", "Please enter a password", the server's message, and "An error occurred while processing your login request", each with an error icon.
* **Password incorrect (iOS):** "Password Incorrect", "Please try again or reset your password", "Forgot your password?" and "Try Again". "Try Again" hides it; the link opens [Forgot password](https://docs.snapfix.com/how-the-apps-work/screens/account/forgot-password.md).
* **Confirm phone number (iOS):** "Confirm phone number", "Please choose the country code below and confirm that your number is correct.", the country code, "Enter mobile phone number" and "Continue". "Continue" joins the dial code and the number and checks the password again. A number the phone library rejects shows "Error" and "Please enter valid phone number", with "Cancel".
* **Confirm phone number (Android):** the same title and sentence, "Enter mobile phone number" and "Continue". The number already typed is not filled in. Empty or invalid shows "Please enter valid phone number". "Continue" writes "+", the country code and the digits into the sign-in phone field and checks the password again; the digits sent then include the country code.
* **Country list (iOS and Android):** from the country button.
* **Mini sign-in (web):** this page as a 365-pixel dialog that cannot be dismissed, without the photo, the logo, the help line or the social buttons. The interceptor opens it when a token refresh fails and the user's `login_src` is `snapfix`; any other login source is logged out instead. Deleting the profile also opens it ([My profile](https://docs.snapfix.com/how-the-apps-work/screens/account/profile.md)). It starts on the code step with the contact filled in and disabled, and offers "Use password" and "Log out" ([Login code](https://docs.snapfix.com/how-the-apps-work/screens/account/login-code.md)). "Use password" shows "Enter password", "Enter the site password that has linked to:" with the masked email (or "…your phone number ending in:" and the last four digits), the password field, "Login", and a back arrow to the code step. Success reloads the page.

## Platform differences

| Topic                         | Web                                                                                                                                                             | iOS                                                                                                                                                                                                          | Android                                                                                                      |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| One-time code at sign-in      | none on the page \[[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)] | none: the control is only on the unused `SmsEmailMainLoginVC` \[[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)] | none                                                                                                         |
| Google, Apple, Microsoft      | logo buttons                                                                                                                                                    | shown, from the code \[[ASK-64](https://github.com/snapfix/docs/blob/main/ASK.md#ask-64-does-the-ios-sign-in-screen-show-google-apple-and-microsoft)]                                                        | logo buttons                                                                                                 |
| Switching the type            | keeps the typed value                                                                                                                                           | clears the field                                                                                                                                                                                             | clears the field                                                                                             |
| Password length               | not checked                                                                                                                                                     | at least six characters                                                                                                                                                                                      | not checked                                                                                                  |
| Phone country                 | Ireland                                                                                                                                                         | device region                                                                                                                                                                                                | device region                                                                                                |
| Google API policy             | not shown                                                                                                                                                       | shown                                                                                                                                                                                                        | shown                                                                                                        |
| Create an account             | no control                                                                                                                                                      | "New to Snapfix? Ask your Admin to set up your account."                                                                                                                                                     | the same                                                                                                     |
| Help line                     | "Having trouble loggin in?"                                                                                                                                     | "Having trouble logging in?"                                                                                                                                                                                 | "Having a trouble loggin in?"                                                                                |
| Password stored on the device | no                                                                                                                                                              | yes                                                                                                                                                                                                          | yes                                                                                                          |
| After success                 | `/fix`                                                                                                                                                          | the app, or [Reloading Snapfix](https://docs.snapfix.com/how-the-apps-work/screens/account/download-data.md)                                                                                                 | the app, or [Reloading Snapfix](https://docs.snapfix.com/how-the-apps-work/screens/account/download-data.md) |

**Invitation token (web).** The page still reads a `?token=` address. With a token it never shows the form, only the loading animation. It looks up the invitee (`POST /invitee`): a failed lookup goes to `/auth/sign-in`, a session in the username answer opens the app, and any other answer leaves the animation on screen \[[ASK-28](https://github.com/snapfix/docs/blob/main/ASK.md#ask-28-is-the-authsign-intoken-link-still-sent)]. No link in the web app opens this address.


---

# 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/sign-in.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.
