Invalid token specified: Cannot read property 'replace' of undefined
See original GitHub issueI get Invalid token specified: Cannot read property ‘replace’ of undefined:
Object.<anonymous> ../node_modules/jwt-decode/lib/index.js 9:0
Showing original source content from sourcemap
'use strict';
var base64_url_decode = require('./base64_url_decode');
function InvalidTokenError(message) {
this.message = message;
}
InvalidTokenError.prototype = new Error();
InvalidTokenError.prototype.name = 'InvalidTokenError';
module.exports = function(token, options) {
if (typeof token !== 'string') {
throw new InvalidTokenError('Invalid token specified');
}
Can i get any help ASAP please?!
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
Invalid token specified: Cannot read property 'replace' of ...
But for some reason it shows "InvalidTokenError: Invalid token specified: Cannot read property 'replace' of undefined" this error, I really need ...
Read more >"Invalid token specified: Cannot read property 'replace ... - 8base
The auth variable that is imported from utils/auth. js is only used in the hosted login example. It works fine when I clone...
Read more >Uipath Robot Error - Invalid token specified: Cannot read ...
Uipath Robot Error - Invalid token specified: Cannot read property 'replace' of undefined. This happens when: I log in into the virtual machine ......
Read more >Issue logging into MS Teams with Guest account
This post has been split from "Invalid token specified: Cannot read property 'replace' of undefined” Im running into the same issue, ...
Read more >[Vue warn]: Error in render function: "InvalidTokenError: Invalid ...
... Invalid token specified: Cannot read property 'replace' of undefined" ... “Copy the CLIENT ID and replace it with the value of ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had same problem as well, If you are login to the App and you did play with token in backend(postman). then token mismatch might happen so you take recent token from postman and add it to the localstorage in the browser, which was in undefined.
In my case, I’m attempting to protect the client-side app against “corrupt” cookies (tokens that aren’t in JWT format) in the event a user messes with their cookies. In the moment I’m decoding, if the token can’t be parsed, the error thrown breaks the app, despite my attempt to catch.
Upon attempting to decode a non-JWT format value, the catch triggers, but the error still shows as Uncaught and breaks runtime: