Skip to content

Commit

Permalink
feat: adds base64 support in webui token (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayusharma committed Jul 26, 2018
1 parent e9660ef commit 4a7a94a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"global": "4.3.2",
"handlebars": "4.0.11",
"http-errors": "1.6.2",
"js-base64": "2.4.8",
"js-string-escape": "1.0.1",
"js-yaml": "3.11.0",
"jsonwebtoken": "8.2.1",
Expand Down
3 changes: 2 additions & 1 deletion src/webui/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import isString from 'lodash/isString';
import isNumber from 'lodash/isNumber';
import capitalize from 'lodash/capitalize';
import {Link} from 'react-router-dom';
import {Base64} from 'js-base64';

import API from '../../utils/api';
import storage from '../../utils/storage';
Expand Down Expand Up @@ -108,7 +109,7 @@ export default class Header extends React.Component {
}

try {
payload = JSON.parse(atob(payload));
payload = JSON.parse(Base64.decode(payload));
} catch (err) {
console.error('Invalid token:', err, token); // eslint-disable-line
return false;
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5425,6 +5425,10 @@ jest@23.2.0:
import-local "^1.0.0"
jest-cli "^23.2.0"

js-base64@2.4.8:
version "2.4.8"
resolved "https://registry.npmjs.org/js-base64/-/js-base64-2.4.8.tgz#57a9b130888f956834aa40c5b165ba59c758f033"

js-base64@^2.1.8, js-base64@^2.1.9:
version "2.4.3"
resolved "https://registry.npmjs.org/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582"
Expand Down

0 comments on commit 4a7a94a

Please sign in to comment.