You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
462 B

  1. var expect = require('chai').expect;
  2. var jwt = require('./..');
  3. var atob = require('atob');
  4. describe('issue 196', function () {
  5. function b64_to_utf8 (str) {
  6. return decodeURIComponent(escape(atob( str )));
  7. }
  8. it('should use issuer provided in payload.iss', function () {
  9. var token = jwt.sign({ iss: 'foo' }, 'shhhhh');
  10. var decoded_issuer = JSON.parse(b64_to_utf8(token.split('.')[1])).iss;
  11. expect(decoded_issuer).to.equal('foo');
  12. });
  13. });