Java Full Stack & Real Time Microserives Project @ 8 AM IST - Reach out in email for updates javaexpresschannel@gmail.com

Monday, May 6, 2024

How to get Refresh Token From Key Cloak Authorization Server ?

To obtain a refresh token from the authorization endpoint for Keycloak in Postman, you can follow these steps:

1. Open Postman.

2. Create a new request by clicking on the '+' button.

3. Set the HTTP method to `POST`.

4. Enter the token endpoint URL in the request URL field. The URL should look like this: `http://localhost:8080/auth/realms/{realm-name}/protocol/openid-connect/token`. Replace `{realm-name}` with your actual realm name.

5. In the `Headers` tab, add a new key-value pair: `Content-Type` and `application/x-www-form-urlencoded`.

6. In the `Body` tab, select `x-www-form-urlencoded` and add the following key-value pairs:

   - `grant_type`: `password`

   - `client_id`: `{your-client-id}`

   - `client_secret`: `{your-client-secret}` (if it's a confidential client)

   - `username`: `{your-username}`

   - `password`: `{your-password}`

7. Click on the `Send` button to make the request.

8. In the response body, you should see a JSON object that contains the `access_token`, `refresh_token`, and other information.

Remember to replace `{your-client-id}`, `{your-client-secret}`, `{your-username}`, and `{your-password}` with your actual client ID, client secret, username, and password.

0 comments:

Post a Comment