Authentication with the react-oidc-context library against Google does not work

49 Views Asked by At

I cannot authenticate with Google using the "react-oidc-context" library. I always get a HTTP 400 status from Google when the library tries to call the /token endpoint. This call is executed after the "Signin" button has been clicked.

<button type="button" onClick={() => auth.signinRedirect()}>

The error description is:

{
 error: "invalid_request", 
 error_description: "client_secret is missing"
}

The code I use is very similar to the code from the react-oidc-context documents.

<AuthProvider {...oidcConfig}>
   ... 
</AuthProvider>

My oidc config looks like:

const oidcConfig = {
  authority: 'https://accounts.google.com',
  client_id: '34534543543543',
  redirect_uri: 'http://localhost:5173',
  scope: 'openid'
}

To be honest, I didn't understand why I need to configure the client_secret in a web application. That makes no sense to me. I have created an OAuth2.0 client of type 'Web' at Google.

Maybe someone can give me a tip.

0

There are 0 best solutions below