| 1 |
Introduction |
| 2 |
============ |
| 3 |
|
| 4 |
The authentication process is an inherently stateful process, as unauthenticated |
| 5 |
users are guided through a number of stages in order to become fully |
| 6 |
authenticated. For example, state is needed to keep track of a user that did |
| 7 |
successfully complete the password stage, but did not yet pass the two-factor |
| 8 |
authentication stage. Similarly, in case of email verificiation using a code, we |
| 9 |
need to keep track of the code and keep track of the number of failed login |
| 10 |
attempts. |
| 11 |
|
| 12 |
The state of the authentication process is stored in the session. When using |
| 13 |
allauth headless in non-browser contexts, such as mobile apps, there is no |
| 14 |
session cookie that can be used to link clients to their session. So, instead of |
| 15 |
relying on cookies, the HTTP header ``X-Session-Token`` is used to keep track |
| 16 |
of the session. The app is required to hand over the session token during the |
| 17 |
authenticaton process. |
| 18 |
|
| 19 |
Once a user is fully authenticated, you can hand out your own type of token by |
| 20 |
setting up a specific :doc:`strategy`. Out of the box, two token strategies are |
| 21 |
offered: :doc:`session-tokens` and :doc:`jwt-tokens`. |