Whenever your application manages users, you will inevitably need to handle email confirmation, password reset, user invitations, and other authentication flows. While not too complicated, they are sort of annoying to implement and we usually use some of the great libraries that handle these flows. Over time though, we found ourselves wanting a little less out of the existing libraries, and a little more control over the flow within our apps.
Enter TokenMaster, a minimal library that handles the logic for basic user management flows. Each of the flows above have common steps, that TokenMaster takes care of: assigning a token for temporary access to an action; completing or rejecting an action using the token, and revoking the token.
Using TokenMaster is easy, simply add the gem to your Rails app, and run a migration for the tokenable class and actions you would like to manage. The migration adds tokenable columns to your tokenable class, and provides access to methods on the instance or class to manage the tokenable flow. Methods include setting a token, completing a tokenable action, checking the status of an action, and sending instructions
to complete the action.