Hi everyone,
I’m using Keycloak for authentication in the backend of my web application. I’ve successfully set up Google SSO by creating a project in the Google API console, and it works fine when using the Keycloak login panel.
However, I’m facing an issue while implementing Google SSO in the backend. Here’s what I’ve done so far:
- Created the Google authorization URL with the redirection URL.
- The account is validated, and I receive the authorization code.
- I send this code to the Keycloak token endpoint to exchange it for a token.
POST Method: https://lb-keycloak.heprasoft.com/realms/{{realm}}/protocol/openid-connect/token
Parameters:
client_id: demo_app
client_secret: **********
grant_type: authorization_code
code: 4/0AcvDMrBahREotn6owNOLl3wAGNohv82qhnlokKRXMrRiN7ajHUh1r5gbSpPDMiOwrW-dSg
redirect_uri: https://www.abcde.com/
Error Response:
{
“error”: “invalid_grant”,
“error_description”: “Code not valid”
}
I’m getting an “invalid_grant” error with the description “Code not valid”. Has anyone encountered this issue or have any suggestions on how to resolve it?
Thanks in advance for your help!