CaptainCodeman/auth-ajax

Provide helpful error if token isn't a valid JWT

Opened this issue · 2 comments

Auth store

When I assign a token to the auth store it throws an error when it attempts to decode the token. (HTMLElement._tokenChanged (auth-store.html:139))
the token is present at this point.

Uncaught TypeError: Cannot read property 'replace' of undefined
at b.exports (jwt-decode.min.js:1)
at b.exports (jwt-decode.min.js:1)
at HTMLElement._tokenChanged (auth-store.html:139)
at HTMLElement._observerEffect (polymer.html:1662)
at HTMLElement._effectEffects (polymer.html:1507)
at HTMLElement._propertySetter (polymer.html:1491)
at HTMLElement.setter (polymer.html:1570)
at HTMLElement._formResponse (email-login-form.js:71)
at HTMLElement.handler (polymer.html:566)
at HTMLFormElement.fire (polymer.html:1343)

nevermind, my token was incorrect

It should probably give a more helpful error message to make it clearer though.