spring-boot-keycloak-tutorial icon indicating copy to clipboard operation
spring-boot-keycloak-tutorial copied to clipboard

Call a REST API secured by keycloak from a desktop app

Open celsofranssa opened this issue 6 years ago • 2 comments

Hello, Thanks a lot for the great tutorial on keycloak.

Could you help me a little more? I have a REST API implemented in Spring Boot and a Desktop app that makes HTTP calls to this api. My question is: how can my application log in to my api using keycloak?

Thank you very much.

celsofranssa avatar Nov 16 '17 02:11 celsofranssa

@Ceceu You could do that by calling the oidc-endpoints directly. you have to allow direct access grants in your clients, then you could call the /auth, /userinfo etc.-endpoints of the realm (see realm configuration => openid connect endpoint configuration - its a hidden link! ;) ) directly and use the token you get in the Authorize header you have to send when calling your Rest API from your desktop api.

Knowing that this is an old thread, one thing for @sebastienblanc : Thanks for your screencast today ;) I implemented the very same thing as you did, actually based on your post back then, but with p3 and a little more beauty. I made a 3-part blog series out of them, available in german at our blog - I don't want to propagate here. You can find the repos in my github account. feel free to use them. I am still trying to translate my posts to english (we have an english blog, too), but ... time ;)

dominikguhr avatar Mar 01 '18 17:03 dominikguhr

okay, damnit. wrong account used :) you can find the repo with frontend, backend and mail-service in MY account ;)

Pinguwien avatar Mar 01 '18 17:03 Pinguwien