Skip to content

Instantly share code, notes, and snippets.

@mediafinger
Created March 6, 2019 12:29
Show Gist options
  • Save mediafinger/4b38ff0ae45ecdb4bbe866b2a643cf25 to your computer and use it in GitHub Desktop.
Save mediafinger/4b38ff0ae45ecdb4bbe866b2a643cf25 to your computer and use it in GitHub Desktop.
JSON Web Token

JSON Web Token (JWT)

We need a way to make authenticated calls from one (self-owned) service to another (self-owned) service.

Secret

We can start with a simple setup, where both services know the used secret.

It is a good practice to implement endpoints to request new secrets which have an expiration time. Another possibility is to set up JWT authentication using an asymmetric algorithm (such as RS256) where the authentication server has a secret key, and the application server has a public key.

Implementation

Ruby gem: https://github.com/jwt/ruby-jwt

Links

More advanced topics:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment