Member-only story
How to get access token from Keycloak using Postman — OAuth2
Here’s how to setup Postman to authenticate on Keycloak using a public client and the Authorization Code grant type.
The configuration of the public client should look like this. We will add another valid redirect URI later on.
Realm id is myRealm
Client id is myPublicClientId
My Keycloak instance is deployed locally at this address http://localhost:9080/auth
In Postman, in the Authorization tab, select OAuth 2.0 and in the configure options:
Auth URL: http://localhost:9080/auth/realms/myRealm/protocol/openid-connect/auth
Access Token URL: http://localhost:9080/auth/realms/myRealm/protocol/openid-connect/token
Click on “Get New Access Token”, it will open the browser. You should see when trying to authenticate.
This is because we need to add another valid URI in public client configuration:
This is the callback url defined in Postman. Add it and save. Once it is done, request for a new Access Token and voila!