{"id":20906631,"url":"https://github.com/authress/rails-devise-starter-kit","last_synced_at":"2026-04-27T14:02:15.137Z","repository":{"id":169755733,"uuid":"645340719","full_name":"Authress/rails-devise-starter-kit","owner":"Authress","description":"Authress Starter Kit: Ruby on Rails with Devise","archived":false,"fork":false,"pushed_at":"2024-02-21T10:48:38.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-28T01:50:39.744Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Authress.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-25T12:43:39.000Z","updated_at":"2023-05-27T14:35:24.000Z","dependencies_parsed_at":"2024-02-21T11:52:51.178Z","dependency_job_id":null,"html_url":"https://github.com/Authress/rails-devise-starter-kit","commit_stats":null,"previous_names":["authress/rails-devise-starter-kit"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Authress/rails-devise-starter-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Authress%2Frails-devise-starter-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Authress%2Frails-devise-starter-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Authress%2Frails-devise-starter-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Authress%2Frails-devise-starter-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Authress","download_url":"https://codeload.github.com/Authress/rails-devise-starter-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Authress%2Frails-devise-starter-kit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32339290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T13:34:25.774Z","updated_at":"2026-04-27T14:02:15.112Z","avatar_url":"https://github.com/Authress.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp id=\"main\" align=\"center\"\u003e\n  \u003cimg src=\"https://authress.io/static/images/linkedin-banner.png\" alt=\"Authress media banner\"\u003e\n\u003c/p\u003e\n\n# Authress Starter Kit: Ruby Rails using Devise\n\nA repository that contains a Ruby on Rails example that uses [Authress](https://authress.io) via the Devise gem to login.\n\n## Getting Started\nThe repository is a simple example using Ruby on Rails. Using the Devise gem and some additional ones the repo add Login with Authress. If you already have a Rails project running with Devise, you can use this repo as an example template and jump down to the [Configuration Section](#configuration) to see what updates should be made to your project to get it from just using Devise to using Devise with Authress.\n\n### Running this project\nThis repo uses ruby `bundler` to install dependencies:\n\n```sh\ngem install bundler rails\nbundle install\n# Starts the server\nbundle exec rails server\n```\n\n## Configuration\n\n### 0. Authress Account\nJust quickly hop over to the [Authress](https://authress.io/app/#/signup) to get a free account if you don't have one already.\n\n### 1. Install Omniauth and Authress SDK\n\nAdd to your Gemfile\n```rb\ngem \"devise\"\ngem \"omniauth\"\ngem \"authress-sdk\"\ngem 'omniauth-rails_csrf_protection'\n```\n\n### 2. Include `:omniauthable` attribute to the app model\nWhere ever you have defined `devise` add the `:omniauthable` attribute to the configuration. This should already be set, but if it isn't, remember to add the necessary attributes:\n* include `omniauth_providers: %i[authress]`\n\n```rb\nclass User \u003c ApplicationRecord\n  devise :database_authenticatable, :registerable,\n         :recoverable, :rememberable, :validatable, :omniauthable, omniauth_providers: %i[authress]\nend\n```\n\nIn `config/routes.rb`:\n\n```rb\nRails.application.routes.draw do\n  devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }\n\n  root to: \"home#index\" \nend\n```\n\n### 3. Add the Authress OmniAuth configuration\n\nCreate the `config/initializers/authress.rb` file:\n\n```rb\nrequire 'authress-sdk'\n\nAuthressSdk.configure do |config|\n  # create an instance of the API class during service initialization\n  # Replace the base_url with the custom Authress domain for your account\n  # https://authress.io/app/#/settings?focus=domain\n  config.base_url = 'https://login.company.com'\nend\n\nif AuthressSdk::AuthressClient.default.base_url == 'https://login.company.com'\n  raise \"Please set the Authress base_url in the authress.rb initializer to your custom domain. The custom domain can be configured at https://authress.io/app/#/settings?focus=domain\"\nend\n\nRails.application.config.middleware.use OmniAuth::Builder do\n  # Application ID generated in Authress dashboard (https://authress.io/app/#/settings?focus=applications)\n  # You can either use the default app `app_default` or create a new one\n  provider :authress, :application_id =\u003e 'app_default'\nend\n\n```\n\n### 4. Add a callback controller\n\nLogin success! But now we need to populate our internal devise User model. Depending on how you implemented this it might be as easy as calling `User.from_omniauth(...)`\n\nIn `app/controllers/users/omniauth_callbacks_controller.rb`:\n\n```rb\nclass Users::OmniauthCallbacksController \u003c Devise::OmniauthCallbacksController\n  def authress\n    # The user has successfully logged in now with omniauth, but needs to be converted to your user model.\n    # So implement this method in your User Model (e.g. app/models/user.rb) so that the @user is populated with the data that you need\n    if false\n      @user = User.from_omniauth(request.env['omniauth.auth'])\n\n      if @user.persisted?\n        flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: 'Authress'\n        sign_in_and_redirect @user, event: :authentication\n      else\n        session['devise.authress_user_data'] = request.env['omniauth.auth'].except('extra') # Removing extra as it can overflow some session stores\n        redirect_to new_user_registration_url, alert: @user.errors.full_messages.join(\"\\n\")\n      end\n    end\n\n    render inline: \\\n    \u003c\u003c~HTML\n      \u003cdiv\u003eYou have successfully logged in using Authress\u003c/div\u003e\n      \u003cbr\u003e\n      \u003cdiv\u003eUser Data Hash:\u003c/div\u003e\n      \u003cpre\u003e#{JSON.pretty_generate(request.env['omniauth.auth'])}\u003c/pre\u003e\n      \u003cbr\u003e\n    HTML\n\n  end\n\n  def failure\n    # Handles failed authentication -- Show a failure page (you can also handle with a redirect)\n    render inline: \\\n    \u003c\u003c~HTML\n      \u003cdiv\u003eYou reached this page due to an error in your OmniAuth configuration. Check the server logs\u003c/div\u003e\n      \u003cdiv\u003eStrategy: #{params['strategy']}\u003c/div\u003e\n      \u003cdiv\u003eMessage: #{params['message']}\u003c/div\u003e\n      \u003cbr\u003e\n      \u003cdiv\u003eUrl Querystring Data: #{params}\u003c/div\u003e\n      \u003cbr\u003e\n      \u003cbr\u003e\n      \u003c%= button_to \"Try Again\", user_authress_omniauth_authorize_path, method: :post %\u003e\n      \u003cbr\u003e\n    HTML\n  end\nend\n```\n\n### 5. Add a login button your webpage\n\nIn any view where you would like a login button add it directly there:\n\n```rb\n\u003c%= button_to \"Sign in with your Corporate identity using Authress\", user_authress_omniauth_authorize_path, method: :post %\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthress%2Frails-devise-starter-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthress%2Frails-devise-starter-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthress%2Frails-devise-starter-kit/lists"}