Image for post
Image for post

After weeks of searching for documentation and examples on how to use node-jose for:

  • Create a /jwks endpoint to expose the public part of the keys
  • Create a /tokens endpoint that returns a signed JWT with those keys
  • Validate the token issued as a client
  • Rotate the keys exposed on the /jwks endpoint

I found very little so here’s how I did it

JWKs endpoint

We are going to need a few things before exposing this endpoint in your app, the first one is definitely generating the keys.

Have you see and integration testing approach that doesn’t make throw up? at least not for the JS planet, because I think during this years I crossed paths with phantom and karma, with selenium and Nightwatch, I had some hopes for CasperJS and slimerJS, even sometimes I pretend that jsdom is reliable and then I realize what I’ve done and cried myself to sleep; until Saturday I found puppeteer is not new I tell you this as a disclaimer but just recently I had the chance to try it.

One day so far so good

How hard can be when running yarn add -D ava puppeteer already brings to your country a headless browser. The first challenge was actually tolaunch a browser .. const browser = await puppeteer.launch({ headless:false }) believe me, is not that hard, what about a new page navigating to localhost not hard at all either, so let me…

In the previous article I described my experience using JSX without React, it was a good experience overall and gave me a better understanding of what React does behind scenes, superficially talking of course.

But that was not the complete experience, implementing the company logo was part of that whole and it was a very SVG focused task.

The first difference that calls my attention is document.createElementNS stands for Name-Space, meaning that SVG elements need to be created like this:

To understand the problem namespaces are trying to solve, consider file extensions. 3-letter file extensions have done a really bad job of describing the content of files. They’re ambiguous and don’t carry version info. XML namespaces use a larger space of strings, URIs, to solve the same problem, and use short prefixes so you can succinctly mix multiple kinds of XML in the same document. …

Click here to share this article on LinkedIn »

Starting the project was the easy part, as every node project yarn init -y will create the barebones and is almost an every week task for a JS enthusiast so let’s not dig into that command; now the dependencies are very minimum, personally, I like to use webpack but, to keep it simple let’s just use babel:

yarn add -D @babel/cli @babel/core @babel/plugin-syntax-jsx @babel-plugin-transform-react

The next step is also trivial, define a .babelrc file at the root and use this content:



wishful thinking: * A world with a better UI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store