Search code examples
keycloakkeycloak-serviceskeycloak-rest-api

Keycloak: All API response with 404


I followed this tutorial to setup Keycloak and create user but the response for the step of Generating Access Tokens With Keycloak's API 404. I'm using Keycloak version 18.0.0

In the logs of keycloak I found this error

2022-06-12 23:59:57,177 DEBUG [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-3) Error response 404: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/auth/realms/test/protocol/openid-connect/token

enter image description here


Solution

  • 404 Error means the URL of the resource does not exist.

    You did set in Headers instead of Body. Move the Key & Values to Body.enter image description here

    In Keycloak version 18

    You can verify Token URL by click "OpenID Endpoint Configuration" link enter image description here

    It will show Token URL enter image description here

    In Keycloak version 21

    enter image description here

    OIDC Well-Known Configuration Endpoint

    Returns the OpenID Connect configuration values from the Keycloak's Well-Known Configuration Endpoint

    GET /.well-known/openid-configuration
    
    http://localhost:8080/realms/[your realm]/.well-known/openid-configuration
    

    Token End Point

    http://localhost:8080/realms/[your realm]/protocol/openid-connect/token
    

    enter image description here

    Get Access Token by Postman. enter image description here