An example Sinatra application demonstrating how MFA works with WorkOS and Ruby.
- Clone the main repo:
git clone https://github.com/workos/ruby-example-applications.git
- Navigate to the MFA app within the main repo and install dependencies:
cd ruby-example-applications/ruby-mfa-example && bundle install
- Grab your API Key and your Client ID.
- Run
cp .env.example .envand add your API key and Client ID. Theworkosgem will read your API key from the ENV variableWORKOS_API_KEYand your Client ID from the ENV variableWORKOS_CLIENT_ID. You may also set the API key and Client ID yourself by addingWorkOS.key = $YOUR_API_KEYandCLIENT_ID = $YOUR_CLIENT_IDtoapp.rb.
ruby app.rb
Head to http://localhost:4567
When testing SMS use the {{code}} parameter in your string as well as whatever other message details that you'd like to send as this will generate a random code that the user can verify
For more information, see the WorkOS Ruby SDK documentation.