nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
372 stars 110 forks source link

Token calls throw an error when email is missing (SMS authentication broken) #539

Closed massless closed 5 days ago

massless commented 5 days ago

We seem to be running an error similar to https://github.com/nhost/hasura-auth/issues/507 and presumably this could be because email fields aren't required for SMS authentication.

After logging in with SMS all calls to https://<domain>/v1/token result in the following error and stack trace (when using @nhost/nhost-js version 3.1.5)

@nhost_nhost-js.js?v=366c4814:5967 Uncaught (in promise) RangeError: Invalid time value
    at Date.toISOString (<anonymous>)
    at accessToken (@nhost_nhost-js.js?v=366c4814:5967:31)
    at @nhost_nhost-js.js?v=366c4814:1150:61
    at Array.reduce (<anonymous>)
    at updateContext (@nhost_nhost-js.js?v=366c4814:1134:48)
    at handleAction (@nhost_nhost-js.js?v=366c4814:1728:26)
    at processBlock (@nhost_nhost-js.js?v=366c4814:1759:24)
    at Array.map (<anonymous>)
    at resolveActions (@nhost_nhost-js.js?v=366c4814:1783:46)
    at StateNode2.resolveTransition (@nhost_nhost-js.js?v=366c4814:4322:22)
    at StateNode2.transition (@nhost_nhost-js.js?v=366c4814:4258:17)
    at @nhost_nhost-js.js?v=366c4814:3139:28
    at provide (@nhost_nhost-js.js?v=366c4814:1791:16)
    at Interpreter2._nextState (@nhost_nhost-js.js?v=366c4814:3138:21)
    at @nhost_nhost-js.js?v=366c4814:2506:31
    at Scheduler2.process (@nhost_nhost-js.js?v=366c4814:2337:7)
    at Scheduler2.schedule (@nhost_nhost-js.js?v=366c4814:2321:10)
    at Interpreter2.send (@nhost_nhost-js.js?v=366c4814:2504:23)
    at _a2.id.id (@nhost_nhost-js.js?v=366c4814:3280:15
dbarrosop commented 5 days ago

Which version are you using? I just remembered we fixed this in 0.32.0

fix: remove email from required fields as some users may not have one @dbarrosop (https://github.com/nhost/hasura-auth/pull/529)

Could you try upgrading if you aren't using 0.32.0?

massless commented 5 days ago

Hey @dbarrosop thanks very much for the suggestion, pretty sure that was it and it's working now