How to get access token from keycloack using postman GET request

Viewed 8415

I'm new to keycloak and tyring to get access token from keycloak using GET request method through postman but experiencing http 405 error (Method not allow)

I already have tried this but it's not working and throwing HTTP 405 error method not allowed

MEHTOD: GET
URL: https://keycloak.carbook-dev.gocarbook.com/auth/realms/carbook/protocol/openid-connect/token
{
    "realm":"carbook",
    "bearer-only":true,
    "grant_type":"password",
    "client_id": "web_app",
    "username":"admin*****",
    "password":"a*****"
}

I'm expecting access token upon successfully completion of that request such as

eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJQk1YWTd0TGpfejg5c1p2Z2JrUHp.....

I can achieve the same using postman GET NEW ACCESS TOKEN form but i want to achieve this through rest call so that later on i could use the same request in cypress to access the token for subsequent calls.

1 Answers

Shouldn't you POST the request instead of GET ? The message seems to tell that GET method is not allowed for this endpoint...

Related