@mark-robustelli Yes, im trying to do the same.
P
Posts made by prince.b
-
RE: Getting error in Google Oauth integration
-
Getting error in Google Oauth integration
Hi there, im using fusion auth for my app. I've been using FA(fusion auth) for discord but now I want to have google login as well. For this, i've created a new identity provider inside FA.
I need access token from google and im using FA for this. Below is the code for it.
const response = await fetch( `${process.env.FUSIONAUTH_URL}/api/identity-provider/login`, { headers: { "Content-Type": "application/json", }, method: "POST", body: JSON.stringify({ applicationId: process.env.FUSIONAUTH_CLIENT_ID, identityProviderId: process.env.FUSIONAUTH_GOOGLE_PROVIDER_ID, data: { code: context.params.code, redirect_uri: context.provider.callbackUrl, }, }), } );
I'm getting error in event logs. Logs:
2/14/2024 11:22:31 AM Z Using code and redirect_uri with login method UseRedirect: 2/14/2024 11:22:31 AM Z Call the [https://oauth2.googleapis.com/token] endpoint. 2/14/2024 11:22:31 AM Z Endpoint returned status code [400] 2/14/2024 11:22:31 AM Z The response was not successful, see the error event log.
Request to the [https://oauth2.googleapis.com/token] endpoint failed. Status code [400] Error response is { "error" : "invalid_grant", "error_description" : "Missing code verifier." }
Could anyone help? I've tried multiple things none worked.
I've tried adding grant_type and code_verifier as query params to FA url, it didn't worked. Like this:const url = `${process.env.FUSIONAUTH_URL}/api/identity-provider/login?code_verifier=${context.checks.code_verifier}`