# Sign in for a SMART app

Canonical page: https://docs.ovok.com/api/smart-app-launch/sign-in-for-a-smart-app

`POST /v1/smart/sign-in`

Signs a user in for a SMART app's standalone launch: one password, then Ovok answers the app itself.

**Scope:** the app's project. The user must have a profile there: a Patient, a Practitioner or a RelatedPerson.

## Behaviour

- The `authorize` parameters are checked as `POST /v1/smart/sign-in/request` checks them.
- The answer is the next step, with a `session` handle for it: `mfa` (an authenticator code), `profile` (choose one of
  the user's profiles in the project), `patient` (pick a patient), or `done`.
- A Patient gets their own record and goes straight to `done`; anyone else picks a patient they may read.
- `done` carries `redirect`: the app's `redirect_uri` with `code` and `state`. The app exchanges the code at
  `https://api.sandbox.ovok.com/oauth2/token` with its PKCE verifier, and its token names the patient.
- A project with login off refuses its users (403), except a practitioner who administers it.
- A session lasts 10 minutes and answers the app once.

## Example

```bash
curl -X POST 'https://api.sandbox.ovok.com/v1/smart/sign-in' -H 'Content-Type: application/json' \
  -d '{"authorize":{"response_type":"code","client_id":"<client id>","redirect_uri":"https://app.example.com/callback","scope":"launch/patient openid fhirUser patient/*.rs","state":"af0ifjsldkj","code_challenge":"<S256 challenge>","code_challenge_method":"S256"},"email":"dr.weber@example.com","password":"<password>"}'
```
