wak-jwks
A Wakanda node module to enable authentication with Auth0.
Requires Wakanda Server 2.1+.
This is definitely a work in progress.
Use it at your own risk.
Assumes you already have a access token from Auth0 (ie following client login).
Pass the access token in the Authorisation header of a request to Wakanda.
On the Wakanda end you will need to run this inside a node worker.
When you receive the request at the Wakanda end, you will need to extract the token from the Authorisation header.
Then pass the token to this module. If the token is valid it will return the decoded token, otherwise it will return an error.
Here is some sample Wakanda code.
exports{ const threadify = ; const jwt = threadify; var returnInfo = success: false var token = requestheaders'AUTHORIZATION'; iftoken iftoken==0 token = token; var checkResult = jwt; ifcheckResultcode // an error occured // this seems do with how Threadify returns results // if an error occurs the result will include a 'code' attribute // if no error occurs the 'code' attribute will not be present returnInfosuccess=false; returnInfomessage=checkResultdata; else returnInfosuccess=true; //TODO do some checking on the decoded result. else returnInfomessage="Authorization Header not properly formed" else returnInfomessage="Authorization Header not found" return returnInfo;}
And then, in jwt-worker, we have:
exports{ const wakJwks = ; const options= kid: <your kid here> jwksUri: 'https://<your-domain>.auth0.com/.well-known/jwks.json' ; }
Pull requests and issues are welcome at https://github.com/chriscurnow/wak-jwks
When I have done some more testing I will add some documentation here.