# No way for external IdP (Google) and Postman?

**URL:** <https://forum.keycloak.org/t/no-way-for-external-idp-google-and-postman/20077>\
**Category:** Configuring the server\
**Tags:** identity-brokering, oidc\
**Created:** [February 6, 2023, 1:33pm UTC](https://forum.keycloak.org/t/no-way-for-external-idp-google-and-postman/20077 "2023-02-06T13:33:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomRom](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@TomRom](https://forum.keycloak.org/u/TomRom)\
**Post date:** [February 6, 2023, 1:33pm UTC](https://forum.keycloak.org/t/no-way-for-external-idp-google-and-postman/20077/1 "2023-02-06T13:33:52Z")

</div>

hi,

Sorry if dumb question but 've spent 2 days on something what should be simple but have no clue why it doesn’t work:  
I’m configuring Keycloak as IdP and access provider i.e. I want login form to make possible to log in using “built in” account as well as using external IdP. I’ve added Google Identity Provider to my realm, configure it with G. client id, secret and redirect uri. Added a client of “OpenID Connect” type to realm.  
All of the above works like a charm when I log in as “build -in” user.

No matter how I do the additional configuration I always have “Invalid format of the code” when trying to get id and access token for this client from Keycloak when login with Google.

The integration with Google is OK, as I can login to Google and can see the code post-ed back to keycloak endpoint [http://localhost:8080/realms/here-my-realm/broker/google/endpoint](http://localhost:8080/realms/here-my-realm/broker/google/endpoint)  
What is the problem, as far I can see is that Keyloack doesn’t exchange Google’s code to Google’e tokens but tries to exchange Google’e code to own token directly:  
POST [http://localhost:8080/realms/here-my-realm/protocol/openid-connect/token](http://localhost:8080/realms/here-my-realm/protocol/openid-connect/token)  
Request Body  
grant\_type: “authorization\_code”  
code: “4/0AWtgzh7fjZ8UsHarsHtImVaAYvwM5S2V8cByxB\_XXXXglceBDdpWvzqanX0pkId8lCVLnA”  
redirect\_uri: “localhost:44300-signin-oidc”  
code\_verifier: “t63OQ2OvCLwkBlGnfzU\_dXGOhieDZQJVXXXXXX”

what obviously can’t work.  
Apparently, the loop to exchange Google’s code to Google’s token, login user and emit Keycloak code is missing.  
My impression was that when choosing Google specific IdP I don’t have to configure anything else, but maybe I’m wrong: Post login flow is empty for this IdP?

The integration with Google is OK, IMO, as I can log in to Keycloak console via Google with this setup.  
So, maybe it is a matter of using Postman? But it fails when using Insomnia too…

The setup is done on latest Quarkus image.

Any help appreciated!

---

<div class="post-metadata">

**Author:** ![TomRom](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@TomRom](https://forum.keycloak.org/u/TomRom)\
**Post date:** [February 7, 2023, 7:23am UTC](https://forum.keycloak.org/t/no-way-for-external-idp-google-and-postman/20077/2 "2023-02-07T07:23:00Z")

</div>

Answer is: yes, there is a way!

My first understanding of the situation was wrong (that Keycloak doesn’t exchange Google’s code to Google’s token …), now I know it is the Postman which prematurely tries to exchange Google’s code to Keycloak token.

Solution here is to use “Authorize in browser” option in Postman. Then it works like a charm 🙂

---

<div class="post-metadata">

**Author:** ![Aghalaryan](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/aghalaryan/32/7708_2.png) [@Aghalaryan](https://forum.keycloak.org/u/Aghalaryan)\
**Post date:** [June 16, 2023, 7:45am UTC](https://forum.keycloak.org/t/no-way-for-external-idp-google-and-postman/20077/3 "2023-06-16T07:45:23Z")

</div>

Hi TomRom.

Could you share your Postman configuration of getting access token for a Google login? I feel I’m doing something wrong as flow is not complete in my case.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![mariocozta](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/mariocozta/32/9749_2.png) [@mariocozta](https://forum.keycloak.org/u/mariocozta)\
**Post date:** [February 11, 2024, 11:43pm UTC](https://forum.keycloak.org/t/no-way-for-external-idp-google-and-postman/20077/4 "2024-02-11T23:43:38Z")

</div>

Got this problem and login in with browser worked like a charm!  
Aghalaryan, its just normal configuration
