All Projects → ueberauth → Ueberauth_google

ueberauth / Ueberauth_google

Licence: mit
Google OAuth2 Strategy for Überauth.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Ueberauth google

Ueberauth github
GitHub OAuth2 Strategy for Überauth
Stars: ✭ 80 (-27.27%)
Mutual labels:  strategy, oauth2, oauth
Socialite
Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.
Stars: ✭ 1,026 (+832.73%)
Mutual labels:  google, oauth2, oauth
Pow assent
Multi-provider authentication for your Pow enabled app
Stars: ✭ 236 (+114.55%)
Mutual labels:  google, oauth2, oauth
Netcore Postgres Oauth Boiler
A basic .NET Core website boilerplate using PostgreSQL for storage, Adminer for db management, Let's Encrypt for SSL certificates and NGINX for routing.
Stars: ✭ 57 (-48.18%)
Mutual labels:  google, oauth2, oauth
Assent
Multi-provider framework in Elixir
Stars: ✭ 126 (+14.55%)
Mutual labels:  google, oauth2, oauth
ueberauth facebook
Facebook OAuth2 Strategy for Überauth.
Stars: ✭ 72 (-34.55%)
Mutual labels:  oauth, oauth2, strategy
Oauth
🔗 OAuth 2.0 implementation for various providers in one place.
Stars: ✭ 336 (+205.45%)
Mutual labels:  google, oauth2, oauth
Visa
Easy third party authentication (OAuth 2.0) for Flutter apps.
Stars: ✭ 50 (-54.55%)
Mutual labels:  oauth2, oauth
Google Auth Library Nodejs
🔑 Google Auth Library for Node.js
Stars: ✭ 1,094 (+894.55%)
Mutual labels:  google, oauth
Mailchimp Api 3.0 Php
A feature rich object-oriented PHP library for interacting with MailChimp's API v3 💌🐵
Stars: ✭ 61 (-44.55%)
Mutual labels:  oauth2, oauth
Weixin
[READ ONLY] Subtree split of the SocialiteProviders/Weixin Provider (see SocialiteProviders/Providers)
Stars: ✭ 84 (-23.64%)
Mutual labels:  oauth2, oauth
Node Oauth2 Server Mongo Example
Working oauth2 server with mongodb storage and minimal configuration
Stars: ✭ 76 (-30.91%)
Mutual labels:  oauth2, oauth
Ueberauth
An Elixir Authentication System for Plug-based Web Applications
Stars: ✭ 1,259 (+1044.55%)
Mutual labels:  oauth2, oauth
Qq
[READ ONLY] Subtree split of the SocialiteProviders/QQ Provider (see SocialiteProviders/Providers)
Stars: ✭ 50 (-54.55%)
Mutual labels:  oauth2, oauth
Outlookgooglecalendarsync
Sync your Outlook and Google calendars
Stars: ✭ 1,113 (+911.82%)
Mutual labels:  google, oauth2
Nemiro.oauth.dll
Nemiro.OAuth is a class library for authorization via OAuth protocol in .NET Framework
Stars: ✭ 45 (-59.09%)
Mutual labels:  google, oauth
Flask Oauthlib
YOU SHOULD USE https://github.com/lepture/authlib
Stars: ✭ 1,429 (+1199.09%)
Mutual labels:  oauth2, oauth
Androidoauth
A simple way to authenticate with Google and Facebook using OAuth 2.0 in Android
Stars: ✭ 88 (-20%)
Mutual labels:  google, oauth
Ring Oauth2
OAuth 2.0 client middleware for Ring
Stars: ✭ 93 (-15.45%)
Mutual labels:  oauth2, oauth
Vue Authenticate
Simple Vue.js authentication library
Stars: ✭ 1,350 (+1127.27%)
Mutual labels:  oauth2, oauth

Überauth Google Hex Version

Google OAuth2 strategy for Überauth.

Installation

  1. Setup your application at Google Developer Console.

  2. Add :ueberauth_google to your list of dependencies in mix.exs:

    def deps do
      [{:ueberauth_google, "~> 0.10"}]
    end
    
  3. Add the strategy to your applications:

    def application do
      [applications: [:ueberauth_google]]
    end
    
  4. Add Google to your Überauth configuration:

    config :ueberauth, Ueberauth,
      providers: [
        google: {Ueberauth.Strategy.Google, []}
      ]
    
  5. Update your provider configuration:

    Use that if you want to read client ID/secret from the environment variables in the compile time:

    config :ueberauth, Ueberauth.Strategy.Google.OAuth,
      client_id: System.get_env("GOOGLE_CLIENT_ID"),
      client_secret: System.get_env("GOOGLE_CLIENT_SECRET")
    

    Use that if you want to read client ID/secret from the environment variables in the run time:

    config :ueberauth, Ueberauth.Strategy.Google.OAuth,
      client_id: {System, :get_env, ["GOOGLE_CLIENT_ID"]},
      client_secret: {System, :get_env, ["GOOGLE_CLIENT_SECRET"]}
    
  6. Include the Überauth plug in your controller:

    defmodule MyApp.AuthController do
      use MyApp.Web, :controller
      plug Ueberauth
      ...
    end
    
  7. Create the request and callback routes if you haven't already:

    scope "/auth", MyApp do
      pipe_through :browser
    
      get "/:provider", AuthController, :request
      get "/:provider/callback", AuthController, :callback
    end
    
  8. Your controller needs to implement callbacks to deal with Ueberauth.Auth and Ueberauth.Failure responses.

For an example implementation see the Überauth Example application.

Calling

Depending on the configured url you can initiate the request through:

/auth/google

Or with options:

/auth/google?scope=email%20profile

By 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:

config :ueberauth, Ueberauth,
  providers: [
    google: {Ueberauth.Strategy.Google, [default_scope: "email profile plus.me"]}
  ]

You 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.

config :ueberauth, Ueberauth,
  providers: [
    google: {Ueberauth.Strategy.Google, [hd: "example.com", prompt: "select_account", access_type: "offline", include_granted_scopes: true]}
  ]

In 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.

config :ueberauth, Ueberauth,
  providers: [
    google: {Ueberauth.Strategy.Google, [userinfo_endpoint: "https://www.googleapis.cn/oauth2/v3/userinfo"]}
  ]

This 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. A third argument may be passed representing a default value if the environment variable is not found, otherwise the library default will be used.

config :ueberauth, Ueberauth,
  providers: [
    google: {Ueberauth.Strategy.Google, [
      userinfo_endpoint: {:system, "GOOGLE_USERINFO_ENDPOINT", "https://www.googleapis.cn/oauth2/v3/userinfo"}
    ]}
  ]

To 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.

License

Please see LICENSE for licensing details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].