Hi! I'm trying to login with the Google provider a...
# general
c
Hi! I'm trying to login with the Google provider and it works, but upon login an error is thrown in the console from supertokens axios: Error: Request failed with status code 400
r
hey!
c
is this a know issue or...?
r
which version of supertokens-auth-react?
c
it's on the backend
sorry, should have said
r
whats the response to the /signinup request?
c
Copy code
error: Error: Request failed with status code 400
    at createError (node_modules/supertokens-node/node_modules/axios/lib/core/createError.js:16:15)
    at settle (node_modules/supertokens-node/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (node_modules/supertokens-node/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:532:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
the login works
but that error is a bit spooky
r
this can happen if you are calling the signinup API twice - the first one works, whilst the second one fails with this error.
So you should check the network tab on the frontend to see that this API is called just once (one call to the OPTIONS API, and one to the actual POST API)
c
Not calling it twice as far as I know
okay I'll check
r
can you confirm though?
c
yeah one sec
Oh yeah, it is called twice 🤔 weird
r
haha!
are you using our supertokens-auth-react SDK?
Or something else?
c
yeah
r
which version of the SDK?
c
should be 0.22.3
but I see there is a new version
r
0.22.3 should work fine.
as in it shouldn't call the API twice
c
could it be because I have both the SessionAuth wrapper and ThirdPartyPasswordlessAuth in the app?
r
not really.
c
okay good 😄
I'm using React 17 and not in strict mode, so it should not call effects twice
r
hmm. we are compatible with react 18 anyway
so really strange that it's calling twice
does it happen all the time?
c
yeah always when logging in with Google
r
and other providers?
c
I just checked, and the two calls happen during the supertokens flow before coming back to my app
don't have any others integrated atm except for facebook, and I don't have or want an fb account so... 😄
r
ok fair.
perhaps @porcellus can help with this
are you rendering the callback screen yourself? or using the default route?
c
default route
Hopefully Porcellus can help! And I gotta say, the support here is phenomenal. I'll ask my client if we can do some kind of contribution at some point
r
thanks!!
c
thank you 😄
r
is it possible for you to use react 18 and check it out? Does it still call it twice?
c
I can try
r
can switch to that, try and and switch back to 17
c
yep same result
I'll keep 18 😄
r
hmm that's really strange
are you doing anything custom at all around this screen or component?
c
no 😄
Copy code
SuperTokens.init({
    appInfo: {
      appName: REACT_APP_AUTH_NAME,
      apiDomain: REACT_APP_AUTH_API_DOMAIN,
      websiteDomain: REACT_APP_AUTH_WEB_DOMAIN,
      apiBasePath: REACT_APP_AUTH_API_PATH,
      websiteBasePath: REACT_APP_AUTH_WEB_PATH
    },
    recipeList: [
      ThirdPartyPasswordless.init({
        contactMethod: 'EMAIL_OR_PHONE',
        emailVerificationFeature: {
          mode: 'REQUIRED'
        },
        signInUpFeature: {
          defaultCountry: 'FI',
          providers: [ThirdPartyPasswordless.Google.init(), ThirdPartyPasswordless.Facebook.init()]
        }
      }),
      Session.init()
    ]
  })
this is my init
then I have the Auth wrappers and the SuperTokens.getRoutingComponent()
r
that's pretty standard
c
yeah
r
can you open an issue about this on our auth-react SDK?
Will have a look
c
actually nevermind
sorry 😄 I removed stuff from the code
I had used
let { doesSessionExist } = useSessionContext()
and when the session came into existence, I fetch user data from the backend. I commented that out and it stopped calling twice
Okay, I had just overcomplicated things. TBH this code was from the auth0 days and I just quickly converted it to check the session from supertokens instead
r
hmm so is this sorted out?
c
it seems so!
oh damn did I put this in general? sorry 😄
you can delete the thread if you want
r
no thats fine! don't worry about it
2 Views