{"id":13507448,"url":"https://github.com/ueberauth/ueberauth_google","last_synced_at":"2025-03-30T08:30:31.266Z","repository":{"id":37925035,"uuid":"46315179","full_name":"ueberauth/ueberauth_google","owner":"ueberauth","description":"Google OAuth2 Strategy for Überauth.","archived":false,"fork":false,"pushed_at":"2024-02-22T15:01:01.000Z","size":103,"stargazers_count":169,"open_issues_count":9,"forks_count":84,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-07T18:05:18.465Z","etag":null,"topics":["google","oauth","oauth2","strategy","ueberauth","ueberauth-strategies"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/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}},"created_at":"2015-11-17T01:32:28.000Z","updated_at":"2024-12-21T23:29:41.000Z","dependencies_parsed_at":"2023-11-14T03:24:35.434Z","dependency_job_id":"d3be81fd-eb7c-44a8-9e8b-52ca019bf2e1","html_url":"https://github.com/ueberauth/ueberauth_google","commit_stats":{"total_commits":93,"total_committers":38,"mean_commits":"2.4473684210526314","dds":0.8172043010752688,"last_synced_commit":"fdd44cdaa219903367c2fc6bc03d933f5ad737db"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth_google","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth_google/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth_google/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberauth%2Fueberauth_google/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ueberauth","download_url":"https://codeload.github.com/ueberauth/ueberauth_google/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246296352,"owners_count":20754625,"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":["google","oauth","oauth2","strategy","ueberauth","ueberauth-strategies"],"created_at":"2024-08-01T02:00:33.898Z","updated_at":"2025-03-30T08:30:30.987Z","avatar_url":"https://github.com/ueberauth.png","language":"Elixir","funding_links":[],"categories":["Authentication"],"sub_categories":[],"readme":"# Überauth Google\n\n[![Continuous Integration](https://github.com/ueberauth/ueberauth_google/actions/workflows/ci.yml/badge.svg)](https://github.com/ueberauth/ueberauth_google/actions/workflows/ci.yml)\n[![Build Status](https://travis-ci.org/ueberauth/ueberauth_google.svg?branch=master)](https://travis-ci.org/ueberauth/ueberauth_google)\n[![Module Version](https://img.shields.io/hexpm/v/ueberauth_google.svg)](https://hex.pm/packages/ueberauth_google)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/ueberauth_google/)\n[![Total Download](https://img.shields.io/hexpm/dt/ueberauth_google.svg)](https://hex.pm/packages/ueberauth_google)\n[![License](https://img.shields.io/hexpm/l/ueberauth_google.svg)](https://github.com/ueberauth/ueberauth_google/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/ueberauth/ueberauth_google.svg)](https://github.com/ueberauth/ueberauth_google/commits/master)\n\n\n\u003e Google OAuth2 strategy for Überauth.\n\n## Installation\n\n1.  Setup your application at [Google Developer Console](https://console.developers.google.com/home).\n\n2.  Add `:ueberauth_google` to your list of dependencies in `mix.exs`:\n\n    ```elixir\n    def deps do\n      [\n        {:ueberauth_google, \"~\u003e 0.10\"}\n      ]\n    end\n    ```\n\n3.  Add Google to your Überauth configuration:\n\n    ```elixir\n    config :ueberauth, Ueberauth,\n      providers: [\n        google: {Ueberauth.Strategy.Google, []}\n      ]\n    ```\n\n4.  Update your provider configuration:\n\n    Use that if you want to read client ID/secret from the environment\n    variables in the compile time:\n\n    ```elixir\n    config :ueberauth, Ueberauth.Strategy.Google.OAuth,\n      client_id: System.get_env(\"GOOGLE_CLIENT_ID\"),\n      client_secret: System.get_env(\"GOOGLE_CLIENT_SECRET\")\n    ```\n\n    Use that if you want to read client ID/secret from the environment\n    variables in the run time:\n\n    ```elixir\n    config :ueberauth, Ueberauth.Strategy.Google.OAuth,\n      client_id: {System, :get_env, [\"GOOGLE_CLIENT_ID\"]},\n      client_secret: {System, :get_env, [\"GOOGLE_CLIENT_SECRET\"]}\n    ```\n\n5.  Include the Überauth plug in your controller:\n\n    ```elixir\n    defmodule MyApp.AuthController do\n      use MyApp.Web, :controller\n      plug Ueberauth\n      ...\n    end\n    ```\n\n6.  Create the request and callback routes if you haven't already:\n\n    ```elixir\n    scope \"/auth\", MyApp do\n      pipe_through :browser\n\n      get \"/:provider\", AuthController, :request\n      get \"/:provider/callback\", AuthController, :callback\n    end\n    ```\n\n7.  Your controller needs to implement callbacks to deal with `Ueberauth.Auth` and `Ueberauth.Failure` responses.\n\nFor an example implementation see the [Überauth Example](https://github.com/ueberauth/ueberauth_example) application.\n\n## Calling\n\nDepending on the configured url you can initiate the request through:\n\n    /auth/google\n\nOr with options:\n\n    /auth/google?scope=email%20profile\n\nBy default the requested scope is \"email\". Scope can be configured either explicitly as a `scope` query value on the request path or in your configuration:\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  providers: [\n    google: {Ueberauth.Strategy.Google, [default_scope: \"email profile plus.me\"]}\n  ]\n```\n\nYou can also pass options such as the `hd` parameter to suggest a particular Google Apps hosted domain (caution, can still be overridden by the user), `prompt` and `access_type` options to request refresh_tokens and offline access (both have to be present), or `include_granted_scopes` parameter to allow [incremental authorization](https://developers.google.com/identity/protocols/oauth2/web-server#incrementalAuth).\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  providers: [\n    google: {Ueberauth.Strategy.Google, [hd: \"example.com\", prompt: \"select_account\", access_type: \"offline\", include_granted_scopes: true]}\n  ]\n```\n\nIn some cases, it may be necessary to update the user info endpoint, such as when deploying to countries that block access to the default endpoint.\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  providers: [\n    google: {Ueberauth.Strategy.Google, [userinfo_endpoint: \"https://www.googleapis.cn/oauth2/v3/userinfo\"]}\n  ]\n```\n\nThis may also be set via runtime configuration by passing a 2 or 3 argument tuple. To use this feature, the first argument must be the atom `:system`, and the second argument must represent the environment variable containing the endpoint url.\nA third argument may be passed representing a default value if the environment variable is not found, otherwise the library default will be used.\n\n```elixir\nconfig :ueberauth, Ueberauth,\n  providers: [\n    google: {Ueberauth.Strategy.Google, [\n      userinfo_endpoint: {:system, \"GOOGLE_USERINFO_ENDPOINT\", \"https://www.googleapis.cn/oauth2/v3/userinfo\"}\n    ]}\n  ]\n```\n\nTo guard against client-side request modification, it's important to still check the domain in `info.urls[:website]` within the `Ueberauth.Auth` struct if you want to limit sign-in to a specific domain.\n\n## Copyright and License\n\nCopyright (c) 2015 Sean Callan\n\nReleased under the MIT License, which can be found in the repository in [LICENSE](https://github.com/ueberauth/ueberauth_google/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fueberauth%2Fueberauth_google","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fueberauth%2Fueberauth_google","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fueberauth%2Fueberauth_google/lists"}