{"id":15668081,"url":"https://github.com/naps62/auther","last_synced_at":"2025-07-29T16:35:34.548Z","repository":{"id":143330371,"uuid":"11101067","full_name":"naps62/auther","owner":"naps62","description":"Simple authentication with Clearance and Omniauth","archived":false,"fork":false,"pushed_at":"2013-09-19T20:38:52.000Z","size":360,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T04:41:51.292Z","etag":null,"topics":[],"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/naps62.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-01T16:45:01.000Z","updated_at":"2014-06-10T11:36:27.000Z","dependencies_parsed_at":"2023-06-25T21:59:56.675Z","dependency_job_id":null,"html_url":"https://github.com/naps62/auther","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/naps62/auther","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naps62%2Fauther","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naps62%2Fauther/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naps62%2Fauther/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naps62%2Fauther/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naps62","download_url":"https://codeload.github.com/naps62/auther/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naps62%2Fauther/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267718304,"owners_count":24133448,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"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-10-03T14:06:24.326Z","updated_at":"2025-07-29T16:35:34.485Z","avatar_url":"https://github.com/naps62.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Auther\n======\n\n[![Build Status](https://travis-ci.org/naps62/auther.png?branch=master)](https://travis-ci.org/naps62/auther)\n[![Code Climate](https://codeclimate.com/github/naps62/auther.png)](https://codeclimate.com/github/naps62/auther)\n[![Dependency Status](https://gemnasium.com/naps62/auther.png)](https://gemnasium.com/naps62/auther)\n\nEasy authentication management based on Clearance and Omniauth\n\nDescription\n===========\n\nAuther aims to provide easy authentication for your Rails app, both via username/password, and via Omniauth.\nThe basic idea is that a user probably wants to have the multiple omniauth providers linked with the same account on your app\n\nOmniauth is supported via an `Autherization` model. When you sign up via an Omniauth provider (i.e. Google), an instance of an `Autherization` is created and linked to your user model\nIf you later try to sign up on the same app via a different provider, and a match is found (i.e., the email associated with both of them is the same), then instead of a new account, you just get linked to the same one\n\nInstallation\n============\n\nInclude the gem in your Gemfile. It's currently not yet released on RubyGems, so get it directly from github:\n```ruby\ngem 'auther', github: 'naps62/auther'\n```\n\nBundle:\n```\nbundle\n```\n\nThen, run the generator. Make sure your development database is up to date (`rake db:migrate`) before doing this:\n```\nrails generate auther:install\n```\n\nThis will do the following:\n\n* create an `Autherization` model\n* insert `Auther::Model` into your `User` model, or create one from scratch if it doesn't exist\n* insert `Auther::Controller` into your `ApplicationController`\n* create the necessary migrations\n* create a `config/initializers/auther.rb`\n\nOmniAuth\n========\n\nFor each provider you want to use you'll have to add the corresponding omniauth provider gem to your Gemfile. A user mantained list of all supported providers is available [here](https://github.com/intridea/omniauth/wiki/List-of-Strategies)\n\nExample:\n```ruby\n# Gemfile\n\ngem 'omniauth-twitter'\ngem 'omniauth-google-oauth2'\n```\n\nYou will also need to provide the APP_ID and APP_SECRET for each one. The prefered way to do this is via a YAML file (by default it's `config/accounts.yml`, but this is configurable):\n```yml\n# config/accounts.yml\n\nauther:\n  twitter:\n    app_id: 'TWITTER_APP_ID'\n    app_secret: 'TWITTER_APP_SECRET'\n  google_oauth2:\n    app_id: 'GOOGLE_APP_ID'\n    app_secret: 'GOOGLE_APP_SECRET'\n```\n\nNOTE: never checkout your APP_ID's and APP_SECRET's to version control. It is recomended to add this file to your `.gitignore``\n\nThis way, Auther will automatically detect both Twitter and Google and attempt to load their strategies. You can also use environment variables or any other method your prefer to access these keys, but you'll have to manually add the providers via the `extra_providers` configuration variable in the initializer\n\n---\n\nFor each provider you want, run the generator for it's strategy:\n```\nrails generate auther:strategy twitter\n```\n\nThis will generate a file `lib/auther/strategies/twitter.rb` that looks like this:\n```ruby\nmodule Auther\n  module Strategies\n    class Twitter \u003c Auther::Strategies::Base\n\n      def omniauth\n        Rails.application.config.middleware.use OmniAuth::Builder do\n          provider :twitter, Auther.accounts['twitter']['app_id'], Auther.accounts['twitter']['app_secret']\n        end\n      end\n\n      def user\n        { }\n      end\n\n      def autherization\n        { }\n      end\n\n    end\n  end\nend\n```\n\nThe `omniauth` method is what will enable the provider, and it's automatically called on startup. `Auther.accounts` is used by default, and refers the the `auther` namespace of your `config/accounts.yml` file. Change here if you get these values from somewhere else.\nYou can also customize the Omniauth call as you like. This will be dependent only on what that specific provider supports\n\nThe `user` and `autherization` methods define a hash of extra values you want to save for each model. Here you can access the raw OmniAuth hash via the `data` method. Let's say you want to have both a `users.twitter_handle` and a `autherizations.link` fields. You'll first have to add them to each of the tables, and make them `attr_accessible` in the models\nNext, just redefine these methods like this:\n```ruby\ndef user\n  { twitter_handle: data.info.nickname }\nend\n\ndef autherization\n  { link: data.info.urls.twitter }\nend\n```\n\nThe values you have available depend on the hash given by each provider (twitter hash described [here](https://github.com/arunagw/omniauth-twitter#authentication-hash))\nThese values will get merged with the default ones (by default, only the provider name, uid token are stored in the autherization) when saving the records.\n\nConfiguration\n=============\n\nThe following variables are available for you to change in the generated initializer:\n```\naccounts_file = File.join('config', 'accounts.yml')\nstrategies_root = File.join(Rails.root, 'lib', 'auther', 'strategies')\nextra_providers = []\nexclude_providers = []\nmailer_sender = 'reply@example.com'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaps62%2Fauther","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaps62%2Fauther","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaps62%2Fauther/lists"}