Search code examples
javascriptjwtgoogle-oauthrhino

Using jwt generation jsrsasign in server script with Rhino


I need to do a JWT to request authorization to Google. Because of the design, it will need to be done on a server script running on Rhino and I have no access to node.js. Google requires a RSA SHA-256 algorithm.

  • jsrsasign needs the navigator object available to run
  • cryptojs does not do a RSA
  • cryptico needs a browser (client script)

At this point I reach a big roadblock, not sure if I will ever be able to do this.


Solution

  • Thanks to Andre Werlang for the help.

    Here is the library that works:

    github.com/kjur/jsrsasign/blob/master/npm/lib/jsrsasign.js

    Works like a charm: KJUR.jws.JWS.sign('RS256', header, claim, private_key);