lokka-transport-jwt-auth
A transport module for Lokka with JWT authentication. This is an extended version of lokka-transport-http which uses JWT tokens. It also refreshes the token if it gets expired.
Setup
npm i -S lokka lokka-transport-jwt-auth
Usage
; // Write a function to create a new (JWT) token.// It should return a token or a promise to a token.// This function will be called again when the token// is about to expire. { const token = 'get-jwt'; return Promise;} // Create a new transport with an http endpoint and the refresh function// If you need to pass additional options to the underlying HTTPTransport// use this form: new JWTAuthTransport(endpoint, options, refresh);const tr = 'http://localhost:8090/path' refresh; // You can start using the transport, requests will be processed// as soon as the token is ready (using the refresh function).tr;