{"id":13507443,"url":"https://github.com/ueberauth/ueberauth","last_synced_at":"2025-05-12T13:24:00.494Z","repository":{"id":21855635,"uuid":"25178958","full_name":"ueberauth/ueberauth","owner":"ueberauth","description":"An Elixir Authentication System for Plug-based Web Applications","archived":false,"fork":false,"pushed_at":"2025-03-25T14:15:41.000Z","size":227,"stargazers_count":1667,"open_issues_count":28,"forks_count":121,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-10T13:58:15.057Z","etag":null,"topics":["authentication","authorization","elixir","oauth","oauth2","ueberauth"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Meg051/Tp-Tics-Dropbox-","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ueberauth.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,"zenodo":null}},"created_at":"2014-10-13T21:37:35.000Z","updated_at":"2025-04-27T23:03:41.000Z","dependencies_parsed_at":"2023-12-01T18:39:22.832Z","dependency_job_id":"2af2e7f4-0e45-41a7-a99a-773ece276ca5","html_url":"https://github.com/ueberauth/ueberauth","commit_stats":{"total_commits":121,"total_committers":58,"mean_commits":2.086206896551724,"dds":0.8512396694214877,"last_synced_commit":"55a49fa30d0737227cd0cedbd6e8b5c0beb18766"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ueberauth","download_url":"https://codeload.github.com/ueberauth/ueberauth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745613,"owners_count":21957410,"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":["authentication","authorization","elixir","oauth","oauth2","ueberauth"],"created_at":"2024-08-01T02:00:33.739Z","updated_at":"2025-05-12T13:24:00.469Z","avatar_url":"https://github.com/ueberauth.png","language":"Elixir","funding_links":[],"categories":["Authentication","Elixir","Tools","Uncategorized"],"sub_categories":["Mesh networks","Uncategorized"],"readme":"# Überauth\n\n[![Continuous Integration](https://github.com/ueberauth/ueberauth/actions/workflows/ci.yml/badge.svg)](https://github.com/ueberauth/ueberauth/actions/workflows/ci.yml)\n[![Codecov](https://codecov.io/gh/ueberauth/ueberauth/branch/master/graph/badge.svg)](https://codecov.io/gh/ueberauth/ueberauth)\n[![Inline docs](http://inch-ci.org/github/ueberauth/ueberauth.svg)](http://inch-ci.org/github/ueberauth/ueberauth)\n[![Hex Version](http://img.shields.io/hexpm/v/ueberauth.svg)](https://hex.pm/packages/ueberauth)\n[![Hex docs](http://img.shields.io/badge/hex.pm-docs-green.svg)](https://hexdocs.pm/ueberauth)\n[![Total Download](https://img.shields.io/hexpm/dt/ueberauth.svg)](https://hex.pm/packages/ueberauth)\n[![License](https://img.shields.io/hexpm/l/ueberauth.svg)](https://github.com/ueberauth/ueberauth/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/ueberauth/ueberauth.svg)](https://github.com/ueberauth/ueberauth/commits/master)\n\n\u003e An Elixir Authentication System for Plug-based Web Applications\n\nUeberauth is a two-phase authentication framework that provides a clear API -\nallowing for many strategies to be created and shared within the community. It\nis most often used with third-party providers. It is heavily inspired by\n[Omniauth](https://github.com/intridea/omniauth). You could call it a port but\nit is significantly different in operation - but almost the same concept.\nHuge hat tip to [Intridea](https://github.com/intridea).\n\nUeberauth provides only the initial authentication challenge, (initial OAuth\nflow, collecting the information from a login form, etc). It does not\nauthenticate each request, that's up to your application, but it integrates\nnicely with `mix phx.gen.auth` generators. You may also use libraries\nlike [Guardian](https://github.com/ueberauth/guardian) for authentication.\n\n## Integration with Phoenix\n\nTo integrate `Ueberauth` with your Phoenix application, the first step\nis to choose your strategy. There are several under [our organization on\nGitHub](https://github.com/ueberauth) and more on [Hex.pm](https://hex.pm).\nSee the [Wiki](https://github.com/ueberauth/ueberauth/wiki/List-of-Strategies)\nfor a complete list.\n\nFor this example, we will use [the GitHub strategy](https://github.com/ueberauth/ueberauth_github).\nYou just need to follow a series of steps:\n\n1.  Setup your application at [GitHub Developer](https://developer.github.com).\n\n2.  Add `:ueberauth_github` to your list of dependencies in `mix.exs`:\n\n    ```elixir\n    def deps do\n      [\n        {:ueberauth_github, \"~\u003e 0.8\"}\n      ]\n    end\n    ```\n\n3.  Add GitHub to your Überauth configuration:\n\n    ```elixir\n    config :ueberauth, Ueberauth,\n      providers: [\n        github: {Ueberauth.Strategy.Github, []}\n      ]\n    ```\n\n4.  Set your provider configuration in `config/runtime.exs`:\n\n    ```elixir\n    config :ueberauth, Ueberauth.Strategy.Github.OAuth,\n      client_id: System.get_env(\"GITHUB_CLIENT_ID\"),\n      client_secret: System.get_env(\"GITHUB_CLIENT_SECRET\")\n    ```\n\n5.  Create the request and callback routes in your `Phoenix.Router`:\n\n    ```elixir\n    scope \"/auth\", MyAppWeb do\n      pipe_through :browser\n\n      get \"/:provider\", AuthController, :request\n      get \"/:provider/callback\", AuthController, :callback\n    end\n    ```\n\n6.  Implement the routes in a controller to deal with `Ueberauth.Auth`\n    and `Ueberauth.Failure` responses.\n\n    ```elixir\n    defmodule MyAppWeb.AuthController do\n      use MyAppWeb, :controller\n      plug Ueberauth\n    \n      def callback(%{assigns: %{ueberauth_failure: %Ueberauth.Failure{}}} = conn, _params) do\n        conn\n        |\u003e put_flash(:error, \"Failed to authenticate\")\n        |\u003e redirect(to: ~p\"/\")\n      end\n    \n      def callback(%{assigns: %{ueberauth_auth: %Ueberauth.Auth{} = auth}} = conn, _params) do\n        # You will have to implement this function that inserts into the database\n        user = MyApp.Accounts.create_user_from_ueberauth!(auth)\n\n        # If you are using mix phx.gen.auth, you can use it to login\n        MyAppWeb.UserAuth.log_in_user(conn, user)\n\n        # If you are not using mix phx.gen.auth, store the user in the session\n        conn\n        |\u003e renew_session()\n        |\u003e put_session(:user_id, user.id)\n        |\u003e redirect(to: ~p\"/\")\n      end\n    end\n    ```\n\nYou will have to implement the function that receives the authentication info\nand creates a new user in the database, such as `create_user_from_ueberauth!`\nabove, and you are good to go!\n\nIf you want to look at an example, check out\n[ueberauth/ueberauth_example](https://github.com/ueberauth/ueberauth_example).\n\n## Strategies\n\nStrategies are plugs that decorate or intercept requests (or both).\n\nStrategies implement the two phases and then may allow the request to flow\nthrough to your downstream plugs. Implementing the request and callback phases\nis optional depending on the strategies requirements. If a strategy does not\nredirect, the request will be decorated with Ueberauth information and\nallowed to carry on through the pipeline.\n\n### Request Phase\n\nThe request phase is where you request information about the user. This could\nbe a redirect to an OAuth2 authorization url or a form for collecting username\nand password. The request phase is concerned with only the collection of\ninformation. When a request comes in on the request phase url the relevant\nstrategy will receive the `handle_request!` call.\n\nIn some cases (default) the application using Ueberauth is responsible for\nimplementing the request phase. That is, you should set up a route to receive\nthe request phase and provide a form etc. In some cases, like OAuth, the\nrequest phase is used to redirect your user to a 3rd party site to fulfill\nthe request.\n\nFor example, an OAuth strategy for GitHub will receive the request phase url\nand stop the request, redirecting you to GitHub’s OAuth challenge url with\nsome query parameters. Once you complete the GitHub OAuth flow, the user will\nbe redirected back to the host site to the callback URL.\n\nAnother example is simple email/password authentication. A request is made by\nthe client to the request phase path and the host application displays a form.\nThe strategy will likely not do anything with the incoming `handle_request!`\nrequest and simply pass through to the application. Once the form is completed,\nthe POST should go to the callback url where it is handled (passwords checked,\nusers created / authenticated).\n\n### Callback Phase\n\nThe callback phase is where the fun happens. Once a successful request phase\nhas been completed, the request phase provider (OAuth provider or host site,\netc) should call the callback URL. The strategy will intercept the request via\nthe `handle_callback!`. If successful, it should prepare the connection so the\n`Ueberauth.Auth` struct can be created, or set errors to indicate a failure.\n\nSee `Ueberauth.Strategy` for more information on constructing the `Ueberauth.Auth`\nstruct.\n\n## Customization\n\n### Configuring providers\n\nYour configuration file (`config/config.exs`) lists the providers you intend to use. For example:\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  providers: [\n    facebook: {Ueberauth.Strategy.Facebook, [opt1: \"value\", opts2: \"value\"]},\n    github: {Ueberauth.Strategy.Github, [opt1: \"value\", opts2: \"value\"]}\n  ]\n```\n\nThis will define two providers for you. The general structure of the providers value is:\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  providers: [\n    \u003cprovider name\u003e: {\u003cStrategy Module\u003e, [\u003cstrategy options\u003e]}\n  ]\n```\n\nWe use the configuration options for defining these to allow for dependency\ninjection in different environments. The provider name will be used to construct\nrequest and response paths (by default) but will also be returned in the\n`Ueberauth.Auth` struct as the `provider` field.\n\nOnce you've setup your providers, you need to configure the `Ueberauth` plug to\nrun. It generally runs before your application routes but in Phoenix applications\nit can also be done in a controller:\n\n```elixir\ndefmodule MyAppWeb.AuthController do\n  use MyAppWeb, :controller\n  plug Ueberauth\n  ...\nend\n```\n\nNow that you have this, your strategies will intercept relevant requests for\neach strategy for both request and callback phases. The default urls are (for\nour Facebook \u0026 GitHub example)\n\n```\n# Request phase paths\n/auth/facebook\n/auth/github\n\n# Callback phase paths\n/auth/facebook/callback\n/auth/github/callback\n```\n\n### Customizing Paths\n\nThese paths can be configured on a per strategy basis by setting options on\nthe provider.\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  base_path: \"/login\", # default is \"/auth\"\n  providers: [\n    identity: {Ueberauth.Strategies.Identity, [request_path: \"/login/identity\",\n                                               callback_path: \"/login/identity/callback\"]}\n  ]\n```\n\n### Customizing JSON Serializer\n\nYour JSON serializer can be configured depending on what you have installed in\nyour application. Defaults to [Jason](https://github.com/michalmuskala/jason).\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  json_library: Poison # default is Jason\n```\n\n### Customizing HTTP Methods\n\nBy default, all callback URLs are only available via the `\"GET\"` method. You\ncan override this via options to your strategy.\n\n```elixir\nproviders: [\n  identity: {Ueberauth.Strategies.Identity, [callback_methods: [\"POST\"]]}\n]\n```\n\n### Strategy Options\n\nAll options that are passed into your strategy are available at runtime to\nmodify the behaviour of the strategy.\n\n## Copyright and License\n\nCopyright (c) 2015 Sonny Scroggin\n\nReleased under the MIT License, which can be found in the repository in [`LICENSE`](https://raw.githubusercontent.com/ueberauth/ueberauth/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fueberauth%2Fueberauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fueberauth%2Fueberauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fueberauth%2Fueberauth/lists"}