'Keycloak: HTTP request with Client Credentials always returns 'login' page

We're developing spring boot service and we managed to setup an OAuth2 with Keycloak and Google as OpenID provider. This works fine in a browser.

Now, I need to create a Spring Boot client for this service.

I understand the Google OpenID is useless here, so I configured a new Client in Keycloak with Access Type : Confidential, Service Accounts Enabled and Client Authenticator : Client Id and Secret.

Problem: When I send a HTTP request to the secured endpoint I receive the Access Token, but only a 'login page', not the expected result from the endpoint.

screenshot from Insomnia (same behavior in Postman)

What am I missing?

Thanks.

Edit1: keycloak config keycloak config



Solution 1:[1]

creating the keycloak from scratch solved my issue. I guess we had set something wrong…

  • We thought we only need one Client for both browser authentication and machine-to-machine, but we need 1 Client per authentication type.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tomáš Johan Prítrský