Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON.parse: unexpected non-whitespace character after JSON data on jwtExp #27

Open
VA1992 opened this issue Mar 24, 2022 · 2 comments
Open

Comments

@VA1992
Copy link

VA1992 commented Mar 24, 2022

On the version 2.3.8 I'm experiencing an issue with the jwtExp function.

unexpected non-whitespace character after JSON data at line 1 column 117 of the JSON data.

Rolling back to 2.3.6 fix the issue.

@liederivative
Copy link

const middlePart = Base64.decode(token.split('.')[1]); <-- here a whitespace is included.

the issue here is in the Base64.decode function, for some reason is adding a whitespace when decoding the string.
A possible solution could be changing the decoder to use atob? it will save some time debugging the current implementation for the decoder.

file location: src/utils/base64.js
Method: decode

Patch:

var Base64 = {
     .....
     // replace current decode function 
    // public method for decoding
    decode: function (input) {
         return decodeURIComponent(atob(input));
    }
 }

@alex-borisova
Copy link

Hello guys!
What is about this issue? I have the same:

SyntaxError: Unexpected non-whitespace character after JSON at position 5112
at JSON.parse ()
at jwtExp (isTokenExpired.js:17:1)
at exports.isTokenExpired (isTokenExpired.js:6:1)
at createAuthProvider.js:72:1
at step (createAuthProvider.js:33:1)
at Object.next (createAuthProvider.js:14:1)
at createAuthProvider.js:8:1
at new Promise ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants