Use the Kno service for passwordless authentication, it handles sending emails so you don't have too. It also allows users to set up device based authentication so they don't have to wait for any email, after the first.
Kno Ruby alternatives and similar gems
Based on the "Authorization" category
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of Kno Ruby or a related project?
Go Passwordless with trykno.com
Use the Kno service for passwordless authentication, it handles sending emails so you don't have to. It also allows users to set up device-based authentication so they don't have to wait for any email (after the first).
kno as a dependency in your
Then, install it using bundler:
$ bundle install
This library integrates Kno into any Rack-based application, including Rails, Hanami and Sinatra.
<!-- - Rails
- Sinatra -->
<!-- See [MyRailsApp](examples/my_rails_app) -->
Kno::Session to the middleware stack, by configuring it in
module MyApp class Application < Rails::Application # ... config.load_defaults 6.0 config.middleware.use Kno::Session, sign_in_redirect: "/" end end
Make sure to add
Kno::Session after the default middleware as it requires the session middleware to be applied.
Add sign in/out button
Use the helpers that Kno added to the request to show the correct sign in, or sign out, button.
<%= request.env['kno'].session_button().html_safe %>
Check the user is authenticated
Controllers can check if a user is authenticated by looking up their
persona_id = request.env['kno'].persona_id
With Kno, users are uniquely identified by their
If the request is unauthenticated, then the value will be nil.
Authentication is now setup for local development. Run locally and click the sign in button and you should see a sign in modal.
[Local development screenshot](assets/images/screenshot.png)
Enter your real email address. Kno runs a service for local development that sends a limited number of emails.
Get production keys
To use Kno in production you will need site and API tokens for your application.
Create an account at trykno.com and follow the guidance to create your first space.
This will direct you to create a
Add these to your environment and edit the middleware configuration.
config.middleware.use Kno::Session, sign_in_redirect: "/" site_token: ENV["KNO_SITE_TOKEN"], api_token: ENV["KNO_API_TOKEN"]
NOTE: The tokens do not have to be stored in the environment. However the api token MUST be kept secure and should not be committed to your applications source code.
Contributions are very welcome. Please do open an issue or pull request or reach out to us at firstname.lastname@example.org
If you do not have node installed, you can run locally in Docker with the following command.
docker run \ -it \ --rm \ -w="/opt/app" \ -v="$(pwd):/opt/app" \ --env="PORT=3000" \ -p="3000:3000" \ --network="host" \ ruby:2.7.0 bash
NOTE: You will need to bundle install every time you start a container with this command