# Sign in

## Sign in to Conduit

The Login route is `/login`.

Sign-in is the authentication step that takes you from the public application into an authenticated
session.

| If you need to… | Go to |
|---|---|
| prepare the information needed for sign-in | [Before you start](#before-you-start) |
| open the sign-in surface | [Open the sign-in page](#open-the-sign-in-page) |
| identify the fields and error area | [Understand the sign-in screen](#understand-the-sign-in-screen) |
| submit your credentials | [Submit your sign-in details](#submit-your-sign-in-details) |
| create an account instead | [Create an account](doc:create-an-account) |
| understand shared authentication messages | [Authentication and loading messages](doc:authentication-and-loading-messages) |
| continue through the initial application journey | [Your first day](doc:your-first-day) |
| resolve a general authentication problem | [Common issues and solutions](doc:common-issues-and-solutions) |

## Before you start

**Prerequisites**

Have an email address and password ready. The Login route is available when the authentication
check allows access for an unauthenticated session.

| What you need | Why it matters |
|---|---|
| Email address | The sign-in form requires an email value. |
| Password | The sign-in form requires a password value. |

## Open the sign-in page

The Login page is where you enter the credentials for an existing account. If you need to create an
account, use the registration route instead.

**Prerequisites**

You are ready to authenticate an existing account, or you know that you need to create an account.

**Steps**

1. Open `/login`, then choose the route that matches your need.

   | If you need to… | Choose |
   |---|---|
   | sign in to an existing account | Stay on the Login page. |
   | create an account | Select **Need an account?** to open registration. |

**Result:** The sign-in form is open, or the registration form is open for account creation.

## Understand the sign-in screen

The sign-in screen contains two credential fields, one submit control, and an area for
authentication errors. The Username field belongs to registration, so the Login form uses Email and
Password instead.

| Screen item | What to enter or expect |
|---|---|
| **Email** | Enter the email address for the account. This field is required. |
| **Password** | Enter the account password. This field is required and accepts password input. |
| **Sign in** | Submit the sign-in form after the required fields contain values. |
| Username | This field appears on the registration form, not the Login form. |
| Authentication error area | A populated error list displays each returned error as a list item. |

When no errors are available, the error list is not displayed. When the service returns an
authentication error, the area can display `Invalid credentials`.

## Submit your sign-in details

Entering the required credentials and selecting **Sign in** sends the sign-in request. The form
prevents submission while it is invalid and disables its fieldset while the request is in progress.

**Prerequisites**

You have the account's email address and password, and the Login page is open.

**Steps**

1. Enter the account email address in **Email**.
2. Enter the account password in **Password**.
3. Select **Sign in**.

**Result:** The sign-in request is submitted. After a successful response, the application navigates
to `/`.

## Handle sign-in alternatives

The Login and Register routes support different account tasks. The Register route adds Username and
changes the submit title to **Sign up**.

**Prerequisites**

Decide whether you are authenticating an existing account or creating a new one.

**Steps**

1. Choose one route.

   | If you need to… | Use this route |
   |---|---|
   | authenticate an existing account | Use `/login` with Email and Password. |
   | create an account | Select **Need an account?** and use `/register` with Username, Email, and Password. |

**Result:** The form matches the account task: Login shows **Sign in**, while Register shows
**Sign up** and includes **Username**.

## When sign-in goes wrong

The authentication error area lists errors returned after a rejected sign-in request. Use the text
shown there to correct the credentials before submitting again.

| What you see | What it means | What to do |
|---|---|---|
| `Invalid credentials` | The submitted credentials were rejected. | Check **Email** and **Password**, then select **Sign in** again. |
| Each server error is displayed as `<key> <value>`. | The error area presents each returned entry using its key and value. | Read the displayed entry, correct the relevant credential, and submit again. |
| An error entry in the authentication error area | The service returned an error entry for the request. | Read the entry, correct the relevant credential, and submit again. |
| No error list | No authentication error needs attention. | Continue with the sign-in form. |

For the wider catalogue of shared messages, see [General error messages](doc:general-error-messages).

## Know what comes next

A successful sign-in takes you to the application's home route, where you can continue with the
authenticated application journey. The authentication flow is shared with account creation and
loading messages.

**Result:** After a successful sign-in, you are at `/` and can continue using the application.

Continue with [Your first day](doc:your-first-day), or review [Authentication and loading
messages](doc:authentication-and-loading-messages).
