Single sign-on across different domains and subdomains in Ruby on Rails, Devise, and PostgreSQL. "Single Sign On"

Job ID: 36352482

Budget: $30 – $350 USD

Good morning, I want a system that the login when you start the session only to log in in a different domain and subdomain that I have
example:
something similar to google
login to accountsgooglecom also login to youtubecom playgooglecom duogooglecom etc

It must be in a separate database.
Auth.example.com ---->> database with devise

Example2.com ---->>< connected to auth database but has its own database

Also have a separate database.
In other words, since each page is a different project, the login system is the only thing that unites it (the login database) and the other projects are independently of their databases.