https://supertokens.com/ logo
Title
u

undesiredmonk

12/24/2022, 6:19 AM
Hi I'm using supertoken with node-fastify and react on front end. I'm getting a wired error on
thirdPartySignInAndUp
function. This is the error {type: 'cors', url: 'http://localhost:20070/auth/signinup', redirected: false, status: 500, ok: false, …}
r

rp

12/24/2022, 7:16 AM
Hey @undesiredmonk
What does the network request tab on chrome show?
u

undesiredmonk

12/25/2022, 1:53 PM
This is the error on the network tab
r

rp

12/25/2022, 2:02 PM
Ah ok. So it seems that there is some issue in the social login config.
@sattvikc can help here.
u

undesiredmonk

12/25/2022, 2:04 PM
Been stuck on this for some time. Would appreciate a help.
r

rp

12/25/2022, 2:05 PM
Sure. A few things to check: - Make sure the provided clientId and secret are correct. - Make sure that if you have given custom scope, it includes email. - If you are making any customisations to signInUp API or have made a custom provider, then show us the code here. - Make sure that the redirect URL configured on the provider's dashboard is correct.
u

undesiredmonk

12/25/2022, 2:50 PM
- Client ID and secrets are correct. The redirect URL is called. - No customizations or to signInUp API, Its happening with Google login
r

rp

12/25/2022, 2:51 PM
alright. So let's wait for @sattvikc to help here.. he will be available tomorrow.
u

undesiredmonk

12/25/2022, 2:52 PM
Anything I could have missed. I'm working with a strict deadline.
r

rp

12/25/2022, 2:53 PM
nothing obvious it seems. One thing to try is that you can use our dev google credentials (in the docs) and does it work with that?
u

undesiredmonk

12/25/2022, 2:55 PM
Can you share the link?
r

rp

12/25/2022, 2:56 PM
u

undesiredmonk

12/25/2022, 2:59 PM
The wired thing is I'm getting the user details. Even though there is an error.
r

rp

12/25/2022, 2:59 PM
hmmm interesting
what is throwing that error?
the cors thing
u

undesiredmonk

12/25/2022, 3:00 PM
r

rp

12/25/2022, 3:01 PM
wait.. but the previous screenshot says request failed with 500
and this last screenshot is giving a response
So you are getting a 500 status code with the correct response body?
u

undesiredmonk

12/25/2022, 3:02 PM
yes
r

rp

12/25/2022, 3:02 PM
thats very weird
the issue might be with your cors middleware
what framework are you using on the backend?
and how have you configured cors?
u

undesiredmonk

12/25/2022, 3:02 PM
fastify
Yes cors is configured.
r

rp

12/25/2022, 3:03 PM
how? Can i see the code?
u

undesiredmonk

12/25/2022, 3:03 PM
Give me a moment. I'll check it once throughly.
Cors config above.
r

rp

12/25/2022, 3:05 PM
can you hardcode the origin instead of using config.appOrigin[0]?
u

undesiredmonk

12/25/2022, 4:24 PM
Was able to resolve the issue. Looks like the plugin was not properly registered.
r

rp

12/25/2022, 4:25 PM
Ah. The CORS one or supertokens one?
u

undesiredmonk

12/25/2022, 4:25 PM
Yes.
r

rp

12/25/2022, 4:25 PM
Which one?
u

undesiredmonk

12/25/2022, 4:25 PM
@rp This
r

rp

12/25/2022, 4:26 PM
Was there an issue in our docs about it? Or something else?
u

undesiredmonk

12/25/2022, 4:27 PM
It was my mistake. Somehow I had two instance of fastify registered.
r

rp

12/25/2022, 4:27 PM
Hmm. I see. Ok!
I’m glad you solved it šŸ™‚
u

undesiredmonk

12/25/2022, 4:27 PM
Thanks for the help. Sorry to bother you with my silly mistake.