# Start a provider sign-in

`POST /api/v1/auth/providers/{provider}/start`

Starts signing in (`signIn`), linking (`connect`) or confirming it is you (`reauth`) at Google or GitHub: the answer is the provider's address to open in the browser. Linking needs a session and, for an account with a password, the password.

Sign-in: none needed; a dashboard session is used when there is one.

Section: Sign-in and account. Operation id in openapi.json: `start_provider_sign_in`.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `provider` | path | yes | string | `google` or `github`. |

## Request body

Required: yes.

`application/json`: ProviderStartInput

| Field | Type | Required | Description |
|---|---|---|---|
| `code` | string \| null | no | `connect` only: a current TOTP code, required with the password when two-factor sign-in is on. |
| `intent` | SignInIntent | yes |  |
| `next` | string \| null | no | A path of the dashboard to go to afterwards (default `/`); `//host` and full URLs are refused. |
| `password` | string \| null | no | `connect` only: the account's current password, required when the account has one. |

## Responses

Errors are `application/problem+json` (`Problem`); branch on `type`.

### 200

The provider's address.

`application/json`: ProviderStartView

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string | yes | The provider's authorization URL: the dashboard navigates the browser there. |

### 400

Bad Request.

- `request.malformed`: the body or a parameter is not of the expected shape
- `auth.credentials_conflict`: the request carries both a session cookie and a token

### 401

Unauthorized.

- `auth.unauthenticated`, `auth.session_expired`: no session, or it ended
- `token.invalid`: the token is malformed, unknown, revoked or expired, or its creator left the workspace

### 403

Forbidden.

- `auth.forbidden`: your role is too low for this
- `token.not_allowed`: this operation needs a signed-in session; tokens cannot call it
- `request.origin_mismatch`, `request.header_required`: a changing request with a session comes from another site or lacks `X-Monitorly-Request: 1`

### 404

Not Found.

- `request.not_found`: it does not exist, or you cannot see it

### 413

Payload Too Large.

- `request.too_large`: the body is larger than 256 KiB

### 422

Unprocessable Entity.

- `field.required`, `field.too_long`, `field.invalid`: a field breaks a rule; `errors` points at it
- `auth.current_password_invalid`: current password is wrong when changing the password (`/currentPassword`; counts as a failed sign-in attempt)

### 429

Too Many Requests.

- `session.rate_limited`: more than 5 changes a second from your sessions
- `auth.rate_limited`: too many failed attempts; `Retry-After` in seconds

Schemas named above are listed with their fields in [the schema list](https://docs.monitorly.cloud/api/reference/schemas.md).
