mensa-kl.de
Mit Fotos und Bewertungen seit 2008.

Clients

Apps and clients using features that require authentication must be registered.

  1. Register your App and receive your App credentials

  2. Request Authorization with your App

Register your App

Introduce your app by sending a mail to mail@mensa-kl.de. Attach a configuration file describing your client(s).

{
  "contact_mail": "your-email@example.com",
  "clients": [
    {
      "app_label": "Example App",
      "cors_url": "https://example.com",
      "auth_url": "https://example.com/my-auth-endpoint"
    },
    {
      "app_label": "Internal Example Test App",
      "cors_url": "https://dev.example.com",
      "auth_url": "https://dev.example.com/my-auth-endpoint"
    }
  ]
}

⚠️ Do not embed secrets in these details, as all app information can be observed by users tracing the login workflow.

Request Authorization

  1. Redirect or open https://www.mensa-kl.de/api/v1/authorize-client. Provide the query parameters specified as AuthorizationRequest.

  2. The user decides whether your application will be authorized.

  3. If the user accepts the authorization request, a redirect with AuthorizationGranted payload is sent to your configured auth_url. Verify the payload before trusting it.

AuthorizationRequest

https://www.mensa-kl.de/api/v1/authorize-client?client_uuid=${CLIENT_UUID}&csrf_token=${CSRF_TOKEN}

AuthorizationGranted

The following details are sent to your app's {auth_url} when the user accepts to share credentials with your app.

https://example.com/my-auth-endpoint?csrf_token=${CSRF_TOKEN}&auth_token=${AUTH_TOKEN}

Talking to the API after Authorization

Always set the Authorization header to execute API requests on behalf of the user who granted authorization.

Authorization: Bearer {auth_token}

HTTP 403

Either the user has no permission to call the API endpoint or the token is no longer authorized. Users can terminate sessions. Your app will not be notified when a session gets terminated.