Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

External authentication

Armand Duijn edited this page Jul 11, 2017 · 7 revisions

Authentication API

The authentication API for the GEWIS website uses JWT tokens and it's usage is described below.

Token

Tokens are JWT tokens. They are signed with the app secret. They always have the type HS256.

Tokens have the following contents:

  • lidnr of the GEWIS Member
  • Expiration time in UTC (tokens are valid for 5 minutes)
  • Creation time in UTC
  • Nonce

Apps

An app has the following properties:

  • Name (just for identification)
  • appId (public)
  • secret (shared between app and the GEWIS Website)
  • callback (URL to be called after authentication)

The callback is required to be hosted on a website that supports SSL (URL starts with https).

Basic flow

  • User requests login from the app
  • App redirects to https://gewis.nl/token/{appId}
  • User logs in on the GEWIS Website if needed
  • The GEWIS Website redirects to {callback}?token={token}
  • The app verifies the token

See also the sequence diagram below:

App authentication

Verifying a token

To verify the token, the following needs to be verified:

  • The HMAC of the token (most JWT libraries should do this automatically, but verify this)
  • Expiration time of the token (it shouldn't be expired)

Clone this wiki locally