Ruby on Rails API behind Keycloak for beginner?

I am investigating Keycloak for authn/authz use for a new Ruby on Rails app. Since I have little experience with auth*, I am looking for more specific guides that illustration integrating Keycloak with Rails. Are there any good guides for this combination of tools?

There are a couple of Rails Gems, and I am currently looking at https://github.com/looorent/keycloak-admin-ruby ; however, it doesn’t go into detail on how to setup basic auth.

For comparison, the Keycloak docs illustrate how to use Keycloak in front of an app - in this case, keycloak.org/app. I don’t know what’s going on behind the scenes in the Keycloak demo app. The Keycloak demo app has a Sign In button, and that sends me to my local keycloak server’s Log In form. There I can login with Github (which I connected to keycloak), and eventually I get sent back to the keycloak demo app.

This is the basic functionality I am trying to replicate with Keycloak + Rails: to illustrate using Keycloak in front of Rails.

Suggestions, direction, and links to guides are welcome.

Thanks in advance!

I have ended up using this gem to verify access_toekn sent by KC server. I have API based app and using token in header and JS app sends token

Since you say you know little about auth*, I would advice you to implement the authorization-flow without gems first. It’s not technically hard, since it’s all about HTTP calls back and forth.

Read up on the OAuth 2.0 RFC (it’s actually very easy to read). The Authorization Code Grant (4.1) is probably what you want to implement with your app being the client and Keycloak being the authorization server (if you use a headless frontend app with an API, the FE would be the client, the BE the resource server). This is what goes on “behind the scenes”, and knowing it makes it easier to use related gems.