If you do not need any integration with existing identity providers, then Devise is all you need. It provides an easy way to manage user accounts, and users will log in using their email addresses and passwords.
It is more difficult to verify the authenticity of another application.
Method 1
If you donβt need a big connection between the two applications, you can log in to the main application and then create a temporary token that the user can use in the secondary application. Finally, the second application includes this line in all messages with the main application. Real world examples include the Pivotal Tracker, which gives users an API key that they can use in web hooks on GitHub.
Trivial example
- The user is sent to Main.com and registered using email and password.
- Main.com creates a temporary token for the user.
- The user provides a token for Sub.com.
- Contact Sub.com Main.com with
<user>:<token>@main.com/some/path?some=query
There are many security issues associated with this, but it is good enough for non-critical use cases. You can use SSL to protect tokens.
Method 2
However, method 1 is not very safe. A more reliable and secure solution is to make the main application an OAuth provider, and then the secondary application authenticate against the main application using OAuth. Here is a Railscast that explains how to do this with DoorKeeper . You can use OmniAuth in the secondary application.
source share