Open Enet4 opened 2 years ago
Are you able to check that the token stored in local storage is a properly formatted JWT token? Are you able to run atob()
in your console against that token?
I just reproduced this in another desktop, and I have a hunch of what the culprit might be.
> var accessToken = localStorage.access_token
undefined
> accessToken.length
237
> atob
ƒ atob() { [native code] }
> atob(accessToken)
VM223:1 Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at <anonymous>:1:1
(anonymous) @ VM223:1
> accessToken.split(' ').length
1
> accessToken.split('.').length
3
> atob(accessToken.split('.')[0])
'{"alg":"HS256","typ":"JWT"}'
> atob(accessToken.slice(accessToken.indexOf('.') + 1, accessToken.indexOf('_')))
'{"unique_name":"á\x95®'
I had changed my display name to include non-ASCII characters (ᕮ_ᑎᕮT4
), and this probably broke the app. The last line above was all I could manage to grab from the unique_name
property.
I'm not sure I'm following... accessToken
is undefined
but accessToken.length
is not?
Ah no, var abc = xyz
always evaluates to undefined
. The access token was indeed defined in the local storage. I had not shown the token verbatim here for precaution.
The problem was that a Unicode display name would either corrupt the token or make the application unable to decode it properly. After changing my display name to something simpler and logging in again, it worked fine. So the way to reproduce it is to have certain non-ASCII characters in the display name on Stack Overflow.
Oh right, of course - that makes more sense! So I've done a bit of digging and there are a few ways to fix this but I might just end up removing the display name from the token altogether. Not sure when I'll have time to look into this, but hopefully within the week. Thanks for the report!
Recently, I've been unable to log in to Higgs in order to classify the various records, both on my personal laptop and on my mobile phone. The first time I press Login, the following console error appears:
In this state, the browser has the local storage key
access_token
defined and is also present in the url's query string, and then with subsequent refreshes the_fb
cookie disappears and the browser only shows a blank page with the same JavaScript error.Is there something more in which I can assist here to track the problem down?
Browser:
(Bringing the Brave shields down did not solve the problem)