Rails app?? I’d think something go-based would be more appropriate for this kind of service.
Why? Rails powers many huge, important things.
Like GitHub.
Implementing sso idp requires pretty good crypto support - last I looked ruby, python, node don't have anything built in and use external native libraries (OpenSSL etc) that are a pain to setup and use securely.