{"id":13879080,"url":"https://github.com/auth0/omniauth-auth0","last_synced_at":"2025-05-14T13:09:36.830Z","repository":{"id":8046455,"uuid":"9457170","full_name":"auth0/omniauth-auth0","owner":"auth0","description":"OmniAuth strategy to login with Auth0","archived":false,"fork":false,"pushed_at":"2024-11-18T11:44:51.000Z","size":469,"stargazers_count":125,"open_issues_count":7,"forks_count":66,"subscribers_count":105,"default_branch":"master","last_synced_at":"2025-04-11T06:12:59.277Z","etag":null,"topics":["dx-sdk","omniauth","omniauth-strategy","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-04-15T20:05:53.000Z","updated_at":"2024-10-31T08:17:36.000Z","dependencies_parsed_at":"2024-01-13T20:57:00.760Z","dependency_job_id":"b16f2804-c017-4fd1-a737-c887f955d89a","html_url":"https://github.com/auth0/omniauth-auth0","commit_stats":{"total_commits":226,"total_committers":60,"mean_commits":"3.7666666666666666","dds":0.9203539823008849,"last_synced_commit":"0cd8eb5b5493319fa5de400b3ff28c42fd8e7528"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fomniauth-auth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fomniauth-auth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fomniauth-auth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fomniauth-auth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/omniauth-auth0/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253864793,"owners_count":21975800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dx-sdk","omniauth","omniauth-strategy","rails","ruby"],"created_at":"2024-08-06T08:02:09.172Z","updated_at":"2025-05-14T13:09:31.801Z","avatar_url":"https://github.com/auth0.png","language":"Ruby","readme":"![Omniauth-auth0](https://cdn.auth0.com/website/sdks/banners/omniauth-auth0-banner.png)\n\n\n[![CircleCI](https://img.shields.io/circleci/project/github/auth0/omniauth-auth0/master.svg)](https://circleci.com/gh/auth0/omniauth-auth0)\n[![codecov](https://codecov.io/gh/auth0/omniauth-auth0/branch/master/graph/badge.svg)](https://codecov.io/gh/auth0/omniauth-auth0)\n[![Gem Version](https://badge.fury.io/rb/omniauth-auth0.svg)](https://badge.fury.io/rb/omniauth-auth0)\n[![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/auth0/omniauth-auth0/blob/master/LICENSE)\n\n\u003cdiv\u003e\n📚 \u003ca href=\"#documentation\"\u003eDocumentation\u003c/a\u003e - 🚀 \u003ca href=\"#getting-started\"\u003eGetting started\u003c/a\u003e - 💻 \u003ca href=\"https://www.rubydoc.info/gems/omniauth-auth0\"\u003eAPI reference\u003c/a\u003e - 💬 \u003ca href=\"#feedback\"\u003eFeedback\u003c/a\u003e\n\u003c/div\u003e\n\n## Documentation\n\n- [Ruby on Rails Quickstart](https://auth0.com/docs/quickstart/webapp/rails)\n- [Sample projects](https://github.com/auth0-samples/auth0-rubyonrails-sample)\n- [API Reference](https://www.rubydoc.info/gems/omniauth-auth0)\n\n## Getting started\n\n### Installation\n\nAdd the following line to your `Gemfile`:\n\n```ruby\ngem 'omniauth-auth0'\n```\n\nIf you're using this strategy with Rails, also add the following for CSRF protection:\n\n```ruby\ngem 'omniauth-rails_csrf_protection'\n```\n\nThen install:\n\n```bash\n$ bundle install\n```\n\nSee our [contributing guide](CONTRIBUTING.md) for information on local installation for development.\n\n## Configure the SDK\n\nAdding the SDK to your Rails app requires a few steps:\n\n- [Create the configuration file](#create-the-configuration-file)\n- [Create the initializer](#create-the-initializer)\n- [Create the callback controller](#create-the-callback-controller)\n- [Add routes](#add-routes)\n\n### Create the configuration file\n\nCreate the file `./config/auth0.yml` within your application directory with the following content:\n\n```yml\ndevelopment:\n  auth0_domain: \u003cYOUR_DOMAIN\u003e\n  auth0_client_id: \u003cYOUR_CLIENT_ID\u003e\n  auth0_client_secret: \u003cYOUR AUTH0 CLIENT SECRET\u003e\n```\n\n### Create the initializer\n\nCreate a new Ruby file in `./config/initializers/auth0.rb` to configure the OmniAuth middleware:\n\n```ruby\nAUTH0_CONFIG = Rails.application.config_for(:auth0)\n\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider(\n    :auth0,\n    AUTH0_CONFIG['auth0_client_id'],\n    AUTH0_CONFIG['auth0_client_secret'],\n    AUTH0_CONFIG['auth0_domain'],\n    callback_path: '/auth/auth0/callback',\n    authorize_params: {\n      scope: 'openid profile'\n    }\n  )\nend\n```\n\n### Create the callback controller\n\nCreate a new controller `./app/controllers/auth0_controller.rb` to handle the callback from Auth0.\n\n\u003e You can also run `rails generate controller auth0 callback failure logout --skip-assets --skip-helper --skip-routes --skip-template-engine` to scaffold this controller for you.\n\n```ruby\n# ./app/controllers/auth0_controller.rb\nclass Auth0Controller \u003c ApplicationController\n  def callback\n    # OmniAuth stores the information returned from Auth0 and the IdP in request.env['omniauth.auth'].\n    # In this code, you will pull the raw_info supplied from the id_token and assign it to the session.\n    # Refer to https://github.com/auth0/omniauth-auth0/blob/master/EXAMPLES.md#example-of-the-resulting-authentication-hash for complete information on 'omniauth.auth' contents.\n    auth_info = request.env['omniauth.auth']\n    session[:userinfo] = auth_info['extra']['raw_info']\n\n    # Redirect to the URL you want after successful auth\n    redirect_to '/dashboard'\n  end\n\n  def failure\n    # Handles failed authentication -- Show a failure page (you can also handle with a redirect)\n    @error_msg = request.params['message']\n  end\n\n  def logout\n    # you will finish this in a later step\n  end\nend\n```\n\n### Add routes\n\nFinally, add the following routes to your `./config/routes.rb` file:\n\n```ruby\nRails.application.routes.draw do\n  # ..\n  get '/auth/auth0/callback' =\u003e 'auth0#callback'\n  get '/auth/failure' =\u003e 'auth0#failure'\n  get '/auth/logout' =\u003e 'auth0#logout'\nend\n```\n\n## Logging in\n\nTo redirect your users to Auth0 for authentication, redirect your users to the `/auth/auth0` endpoint of your app. One way to do this is to use a link or button on a page:\n\n```html\n\u003c%= button_to 'Login', '/auth/auth0', method: :post %\u003e\n```\n\n## Feedback\n\n### Contributing\n\nWe appreciate feedback and contribution to this repo! Before you get started, please see the following:\n\n- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)\n- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)\n- [This repo's contribution guide](https://github.com/auth0/omniauth-auth0/blob/master/CONTRIBUTING.md)\n\n### Raise an issue\n\nTo provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/omniauth-auth0/issues).\n\n### Vulnerability Reporting\n\nPlease do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png\" width=\"150\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\" width=\"150\"\u003e\n    \u003cimg alt=\"Auth0 Logo\" src=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\" width=\"150\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout \u003ca href=\"https://auth0.com/why-auth0\"\u003eWhy Auth0?\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  This project is licensed under the MIT license. See the \u003ca href=\"https://github.com/auth0/omniauth-auth0/blob/master/LICENSE\"\u003e LICENSE\u003c/a\u003e file for more info.\n\u003c/p\u003e\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fomniauth-auth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fomniauth-auth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fomniauth-auth0/lists"}