Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get access token from keycloack using postman GET request

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.

like image 493
Kashif Ali Avatar asked Jan 22 '26 23:01

Kashif Ali


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...

like image 142
TriYop Avatar answered Jan 25 '26 07:01

TriYop



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!