labd / node-federated-token

Tokens for federated services
MIT License
1 stars 0 forks source link

Federated Token

npm

This package provides support for using JWT tokens for clients and passing that information to all federated services. The JWT token includes a JWE token for sensitive information like the client specific access tokens of third party systems.

It provides three Apollo specific classes:

When a federated services creates a new token (when non exist) it can also return a refresh token in the x-refresh-token header. The gateway will then encrypt all refresh tokens and encrypt them before passing them to the client as x-refresh-token header.

Token sources

Public tokens can be passed via either HTTP headers or cookies. For browser clients cookies are the preferred way since these are easiest to store safely in the browser using a combination of HTTP_ONLY cookies and non-HTTP_ONLY cookies.

Cookie Token Source

This token source is used for browser clients to safely store the token. It is implemented via 4 cookies:

Note that this expects the "cookie-parser" express middleware to be used.