OpenFolia

Sign in with a code by email

POST
/auth/email-code/sign-in

Checks the email address and the code emailed to it and starts a session: the cookie __Host-openfolia-session, as a password or a provider’s sign-in does, ending the browser’s previous session. The code works once. An unknown address, no code, a wrong code and one past its time are all 401 invalid-code, in the same time. A wrong code counts toward the address’s tries (CCMS_PASSWORD_FAILURES_*); the try that uses them up revokes the code, and further tries are 429 until the window ends. A code takes five tries at most. Recorded as user.sign-in (data.method email-code).

Request Body

application/vnd.api+json
  1. body
data*

Response Body

application/vnd.api+json
  1. response
meta*
Example Request
curl -X POST 'http://localhost:3000/auth/email-code/sign-in' \  -H 'Content-Type: application/vnd.api+json' \  -d '{  "data": {    "type": "EmailCodeSignIn",    "attributes": {      "email": "string",      "code": "string"    }  }}'
Example Response
{  "meta": {    "userId": "string"  }}