The project is in a healthy, maintained state
PHCDevworks Accounts Stytch is a Ruby on Rails Engine for Stytch Authentication.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 9.1
~> 7.2
 Project Readme

PHCDevworks Accounts Stytch

Forks Stars

Overview

Issues Dependabot Status codecov Build Status CodeQL Gem Version

PHCDevworks Accounts Stytch is an authentication system that integrates with the Stytch API to provide seamless B2B and B2C user authentication for Ruby on Rails apps. The project includes:

Key Features:

  • Magic Link Authentication: Users can authenticate via secure magic links sent to their email.
  • Password Authentication: Support for password-based login and reset flows, including registration and session management.
  • Password Reset Management: Users can reset their passwords via email, token, existing password, or session token.
  • Organization Support: The B2B module includes organization-specific user authentication with integration of organization IDs.
  • Service Handling: All service actions are abstracted into service objects that handle interaction with Stytch’s API for better maintainability and testability.
  • Error Handling & Logging: Robust error logging and consistent handling of service responses ensure reliability and traceability of issues.

Usage

1. Set up Stytch API credentials

You will need to store your Stytch API credentials securely in your Rails credentials.yml.enc file. Follow these steps to open and edit the credentials file:

  1. Ensure you have the master.key file located in config/master.key.
  2. Open the encrypted credentials file using the following command in your terminal:
rails credentials:edit
  1. This will open the credentials file in your default text editor (or VSCode if configured). In the file, add your Stytch API credentials under both b2b and b2c keys, as shown below:
stytch:
  b2b:
    project_id: <your_b2b_project_id>
    secret: <your_b2b_secret>
  b2c:
    project_id: <your_b2c_project_id>
    secret: <your_b2c_secret>
  1. Save and close the file. Rails will automatically re-encrypt the credentials.

Installation

Add this line to your application's Gemfile:

gem "phcdevworks_accounts_stytch"

And then execute:

$ bundle

Or install it yourself as:

$ gem install phcdevworks_accounts_stytch

Contributing

contributors

Last Commit All Contributors

License

The gem is available as open source under the terms of the MIT License.

License