Authentication (Allauth Headless)

Authenticates with a third-party provider using provider tokens received by other means. For example, in case of a mobile app, the authentication flow runs completely on the device itself, without any interaction with the API. Then, when the (device) authentication completes and the mobile app receives an access and/or ID token, it can hand over these tokens via this endpoint to authenticate on the server.

post/api/v2/allauth/browser/v1/auth/provider/token

Request

  • The document declares no server URL.
  • Auth: none declared

Path parameters

client'app' | 'browser' required

The type of client accessing the API.

Headers

X-Session-Tokenstring

Session token. Only needed when client is equal to app.

Request body

providerstring required

The provider ID.

process'login' | 'connect' required

The process to be executed when the user successfully authenticates. When set to login, the user will be logged into the account to which the provider account is connected, or if no such account exists, a signup will occur. If set to connect, the provider account will be connected to the list of provider accounts for the currently authenticated user.

Example request

{
  "provider": "google",
  "process": "login",
  "token": {
    "client_id": "123.apps.googleusercontent.com",
    "id_token": "eyJhbGciOiJI",
    "access_token": "36POk6yJV_adQs"
  }
}

Response

The user is authenticated.

status200 required

Example response

{
  "data": {
    "user": {
      "id": 123,
      "display": "Magic Wizard",
      "email": "email@domain.org",
      "has_usable_password": true,
      "username": "wizard",
      "has_validated_password": true
    },
    "methods": [
      {
        "at": 1711555057.065702,
        "email": "email@domain.org",
        "username": "wizard"
      }
    ]
  },
  "meta": {
    "session_token": "ufwcig0zen9skyd545jc0fkq813ghar2",
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdW"
  }
}

Changes

    • info

      added the required property // to the response with the status