Giter VIP home page Giter VIP logo

ueberauth_google's Introduction

Überauth

Build Status Codecov Inline docs Hex Version Hex docs Total Download License Last Updated

An Elixir Authentication System for Plug-based Web Applications

Ueberauth is a two-phase authentication framework that provides a clear API - allowing for many strategies to be created and shared within the community. It is heavily inspired by Omniauth. You could call it a port but it is significantly different in operation - but almost the same concept. Huge hat tip to Intridea.

Ueberauth provides only the initial authentication challenge, (initial OAuth flow, collecting the information from a login form, etc). It does not authenticate each request, that's up to your application. You could issue a token or put the result into a session for your applications needs. Libraries like Guardian can help you with that aspect of authentication.

The two phases are request and callback. These phases are implemented by Strategies.

Strategies

Strategies are plugs that decorate or intercept requests (or both).

Strategies implement the two phases and then may allow the request to flow through to your downstream plugs. Implementing the request and callback phases is optional depending on the strategies requirements. If a strategy does not redirect, the request will be decorated with Ueberauth information and allowed to carry on through the pipeline.

See the full list of the strategies on the Wiki.

Request Phase

The request phase is where you request information about the user. This could be a redirect to an OAuth2 authorization url or a form for collecting username and password. The request phase is concerned with only the collection of information. When a request comes in on the request phase url the relevant strategy will receive the handle_request! call.

In some cases (default) the application using Ueberauth is responsible for implementing the request phase. That is, you should set up a route to receive the request phase and provide a form etc. In some cases, like OAuth, the request phase is used to redirect your user to a 3rd party site to fulfill the request.

For example, an OAuth strategy for GitHub will receive the request phase url and stop the request, redirecting you to GitHub’s OAuth challenge url with some query parameters. Once you complete the GitHub OAuth flow, the user will be redirected back to the host site to the callback URL.

Another example is simple email/password authentication. A request is made by the client to the request phase path and the host application displays a form. The strategy will likely not do anything with the incoming handle_request! request and simply pass through to the application. Once the form is completed, the POST should go to the callback url where it is handled (passwords checked, users created / authenticated).

Callback Phase

The callback phase is where the fun happens. Once a successful request phase has been completed, the request phase provider (OAuth provider or host site, etc) should call the callback URL. The strategy will intercept the request via the handle_callback!. If successful, it should prepare the connection so the Ueberauth.Auth struct can be created, or set errors to indicate a failure.

See Ueberauth.Strategy for more information on constructing the Ueberauth.Auth struct.

Looking for an example? Take a look ueberauth/ueberauth_example.

Setup

Add the dependency

# mix.exs

defp deps do
  # Add the dependency
  [{:ueberauth, "~> 0.10"}]
end

Fetch the dependencies

mix deps.get

Configuring providers

In your configuration file (config/config.exs) provide a list of the providers you intend to use. For example:

config :ueberauth, Ueberauth,
  providers: [
    facebook: { Ueberauth.Strategy.Facebook, [ opt1: "value", opts2: "value" ] },
    github: { Ueberauth.Strategy.Github, [ opt1: "value", opts2: "value" ] }
  ]

This will define two providers for you. The general structure of the providers value is:

config :ueberauth, Ueberauth,
  providers: [
    <provider name>: { <Strategy Module>, [ <strategy options> ] }
  ]

We use the configuration options for defining these to allow for dependency injection in different environments. The provider name will be used to construct request and response paths (by default) but will also be returned in the Ueberauth.Auth struct as the provider field.

Once you've setup your providers, in your router you need to configure the plug to run. The plug should run before your application routes.

In phoenix, plug this module in your controller:

defmodule MyApp.AuthController do
  use MyApp.Web, :controller
  plug Ueberauth
  ...
end

Its URL matching is done via pattern matching rather than explicit runtime checks so your strategies will only fire for relevant requests.

Now that you have this, your strategies will intercept relevant requests for each strategy for both request and callback phases. The default urls are (for our Facebook & GitHub example)

# Request phase paths
/auth/facebook
/auth/github

# Callback phase paths
/auth/facebook/callback
/auth/github/callback

Customizing Paths

These paths can be configured on a per strategy basis by setting options on the provider.

Note: These paths are absolute

config :ueberauth, Ueberauth,
  base_path: "/login", # default is "/auth"
  providers: [
    identity: {Ueberauth.Strategies.Identity, [request_path: "/login/identity",
                                               callback_path: "/login/identity/callback"]}
  ]

Customizing JSON Serializer

Your JSON serializer can be configured depending on what you have installed in your application. Defaults to Jason.

config :ueberauth, Ueberauth,
  json_library: Poison # default is Jason

HTTP Methods

By default, all callback URLs are only available via the "GET" method. You can override this via options to your strategy.

providers: [
  identity: {Ueberauth.Strategies.Identity, [callback_methods: ["POST"]]}
]

Strategy Options

All options that are passed into your strategy are available at runtime to modify the behaviour of the strategy.

Copyright and License

Copyright (c) 2015 Sonny Scroggin

Released under the MIT License, which can be found in the repository in LICENSE.

ueberauth_google's People

Contributors

alejandrodevs avatar angelikatyborska avatar axelson avatar cgorshing avatar doomspork avatar evadne avatar foxtrod avatar hanspagh avatar henb avatar jochakovsky avatar kianmeng avatar lorantkurthy avatar lukaszsamson avatar mdlkxzmcp avatar mspanc avatar nburkley avatar niku avatar parkerl avatar pragtob avatar ramortegui avatar scottmessinger avatar scrogson avatar snewcomer avatar stevedomin avatar tsubery avatar venkatd avatar wkirschbaum avatar ybur-yug avatar yordis avatar yuyabee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ueberauth_google's Issues

hexdocs has a bug in it

The hexdocs show

config :ueberauth, Ueberauth,
  providers: [
    google: [ { Ueberauth.Strategy.Google, [] } ]
  ]

It should be, like in the README,

config :ueberauth, Ueberauth,
  providers: [
    google: { Ueberauth.Strategy.Google, [] }
  ]

Document API-backed mobile app workflow

I'm opening this issue to begin discussing mobile app flow for google oauth2, which I feel is either under-documented or unsupported (and needs to be documented as unsupported).

Problem:

This library calls for both a client_id and client_secret with no mention of how to work without a client_secret. When generating a Oauth client ID in the google developer console, neither iOS app nor Android app generate a client secret.

Scenario:

Ueberauth is used for an API that backs an android app. Google sign-in is added to the app. Following the android documentation this will bring up native components rather than using a web-redirect flow. This is still a valid oauth scenario and something which an API could potentially desire.

I've manually implemented this auth flow in Python previously, and I'd be happy to help if there is development effort needed here.

Hackney not running?

Hi,

I tried to set up Ueberauth with Google auth recently and ran into an error due to hackney not running.

The ueberauth example app seems to run fine, so I'm wondering what I might be missing (or what may have changed recently that is not reflected in the example app) ?

How do I get scopes which are not under userinfo?

Sorry this is probably an obvious question but how would I request an OAuth token with scopes which are not under userinfo? For instance, the drive scope? I've tried sticking drive in the default scopes and messing around with the userinfo_endpoint parameter but neither of these seem to work. Both of these give 400 errors on the Google side.

Is this library only designed to give the userinfo scopes and I'm missing something fundamental about how OAuth is intended to work?

Thanks in advance and sorry for the stupid questions!

What would cause "No code received" error?

I sometimes get an exception in my logs, "No code received" for my app when running in production, but I can never reproduce it. Does anyone know what might cause a missing_code "No code received" error to occur?

Here's my config: (client_id and client_secret omitted)

config :ueberauth, Ueberauth,
  providers: [
    google: {
      Ueberauth.Strategy.Google,
      [
        request_path: "/login",
        callback_path: "/auth/google/callback",
        default_scope: "email profile"
      ]
    }
  ]

Should the strategy be responsible of validating the "hd" attribute?

Hello folks.

In the README it's written:

the hd parameter to suggest a particular Google Apps hosted domain (caution, can still be overridden by the user)

If I look at the Ruby Google OAuth2 Omniauth strategy (Ueberauth philosophy is based on Omniauth for people who don't know), we can see that the strategy is validating the hd parameter during the callback phase and raising an exception if the domain is invalid:
https://github.com/zquestz/omniauth-google-oauth2/blob/master/lib/omniauth/strategies/google_oauth2.rb#L213

So my question is: do you think this strategy should also validate the hd parameter like the Ruby one?
Would you accept a PR which would implement such behaviour?

Thanks!

Passing custom parameters to auth flow

Without access_type, I'm not able to get a refresh token for offline access, so I patched the lib for some customer parameters that I wanted.

  @doc """
  Handles initial request for Google authentication.
  """
  def handle_request!(conn) do
    scopes = conn.params["scope"] || option(conn, :default_scope)
    # added response_type, access_type, and approval_prompt
    opts = [ scope: scopes, response_type: "code", access_type: "offline", approval_prompt: "force" ]
    if conn.params["state"], do: opts = Keyword.put(opts, :state, conn.params["state"])
    opts = Keyword.put(opts, :redirect_uri, callback_url(conn))

    redirect!(conn, Ueberauth.Strategy.Google.OAuth.authorize_url!(opts))
  end

What is the proper way to pass custom options? If this isn't supported, what can I do to help improve the library? Thanks!

(CaseClauseError) no case clause matching:

I got all my IDs from the Google console, plugged them into the sample app and I got this error (it's at the very end). After I enabled the API things worked fine. I'm not sure if this is something that can be handled by the library itself (i.e. this case, when API is not turned on) or in the controller.

** (CaseClauseError) no case clause matching: {:ok, %OAuth2.Response{body: %{"error" => %{"code" => 403, "errors" => [%{"domain" => "usageLimits", "extendedHelp" => "https://console.developers.google.com/apis/api/plus/overview?project=889214574482", "message" => "Access Not Configured. Google+ API has not been used in project 889214574482 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/plus/overview?project=889214574482 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.", "reason" => "accessNotConfigured"}], "message" => "Access Not Configured. Google+ API has not been used in project 889214574482 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/plus/overview?project=889214574482 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."}}, headers: [{"Vary", "X-Origin"}, {"Content-Type", "application/json; charset=UTF-8"}, {"Date", "Sat, 16 Apr 2016 23:07:47 GMT"}, {"Expires", "Sat, 16 Apr 2016 23:07:47 GMT"}, {"Cache-Control", "private, max-age=0"}, {"X-Content-Type-Options", "nosniff"}, {"X-Frame-Options", "SAMEORIGIN"}, {"X-XSS-Protection", "1; mode=block"}, {"Server", "GSE"}, {"Alternate-Protocol", "443:quic"}, {"Alt-Svc", "quic=":443"; ma=2592000; v="32,31,30,29,28,27,26,25""}, {"Accept-Ranges", "none"}, {"Vary", "Origin,Accept-Encoding"}, {"Transfer-Encoding", "chunked"}], status_code: 403}}

Getting a 403 error, no details

I set up my application similar to the example application.

I can reach the consent screen. However, right after I click "allow", I get an error:

%Ueberauth.Failure{errors: [%Ueberauth.Failure.Error{message: 403,
   message_key: "OAuth2"}], provider: :google,
 strategy: Ueberauth.Strategy.Google}

How do I get more details about this error so that I can troubleshoot?

EDIT: It works if I remove default_scope: "https://www.googleapis.com/auth/calendar" from the config. Is there an issue with this scope with regards to this library?

How to pass custom state after the CSRF refactoring?

Hi!

I have noticed that after #82 the state query parameter is set internally by Ueberauth to perform CSRF validation.

The question now is, can we still pass custom state data during the OAuth process? Does anyone know how?

It seems that whatever you pass via the state query param gets overwritten with Ueberauth's CSRF token. This breaks our app logic, which uses state to know where to redirect users after login.

Thanks!

HTTPS Not Working Behind Proxy

Using NGINX to do SSL offloading there doesn't seem to be a way to make the OAuth request with a callback URI that uses HTTPS instead of HTTP.

Is there any way to make it possible to either manually specify HTTPS or a Callback URI?

Runtime config should be put in config/runtime.exs?

Hi all,

currently the guide shows that we configure the runtime environment like this: https://github.com/ueberauth/ueberauth_google/blob/master/README.md#installation

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"]}

Should we put the config in config/runtime.exs like the following:

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

CaseClauseError fetching user from OAuth response

I've hit a clause error I'd like to document here for anyone to pick up. Also, I might find some time to tackle this myself later. I don't have much context, since it was simply picked up by Sentry.

From just looking at the exception, my best guess is that 500 is the status code from google, and ueberauth isn't handling that API failure?

Elixir.CaseClauseError: no case clause matching: {:ok, %OAuth2.Response{
  body: %{}, 
  headers: [
    {"vary", "X-Origin"}, 
    {"content-type", "application/json; charset=UTF-8"}, 
    {"date", "Tue, 25 Jul 2017 14:15:47 GMT"}, 
    {"expires", "Tue, 25 Jul 2017 14:15:47 GMT"}, 
    {"cache-control", "private, max-age=0"}, 
    {"x-content-type-options", "nosniff"}, 
    {"x-frame-options", "SAMEORIGIN"}, 
    {"x-xss-protection", "1; mode=block"}, 
    {"server", "GSE"}, 
    {"alt-svc", "quic=\":443\"; ma=2592000; v=\"39,38,37,36,35\""}, 
    {"accept-ranges", "none"}, 
    {"vary", "Origin,Accept-Encoding"}, 
    {"transfer-encoding", "chunked"}
  ], 
  status_code: 500}}
  File "lib/ueberauth/strategy/google.ex", line 126, in Ueberauth.Strategy.Google.fetch_user/2
  File "lib/ueberauth/strategy.ex", line 299, in Ueberauth.Strategy.run_callback/2
  File "web/controllers/auth_controller.ex", line 1, in Auth.AuthController.phoenix_controller_pipeline/2
    defmodule Auth.AuthController do
  File "lib/auth/endpoint.ex", line 1, in Auth.Endpoint.instrument/4
    defmodule Auth.Endpoint do
  File "lib/phoenix/router.ex", line 261, in Auth.Router.dispatch/2
  File "web/router.ex", line 1, in Auth.Router.do_call/2
    defmodule Auth.Router do
  File "lib/plug/error_handler.ex", line 64, in Auth.Router.call/2
  File "lib/auth/endpoint.ex", line 1, in Auth.Endpoint.phoenix_pipeline/1
    defmodule Auth.Endpoint do

Default `prompt` param

Hello, seem like it is quite impossible to pass default prompt param in provider options. It works only if prompt is passed as a query param. Btw, to get refresh_token from google you need to pass both prompt=consent and access_type=offline simultaneously. approval_prompt Mentioned in docs doesn't work for this purpose.

`default_scope` in README doesn't work

My config:

config :ueberauth, Ueberauth,
  providers: [
    google: {Ueberauth.Strategy.Google, [default_scope: "emails profile plus.me", approval_prompt: "force", access_type: "offline"]}
  ]

Response from Google:

Error: invalid_scope

Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/userinfo.profile], invalid=[emails, plus.me]}

Per Strategy callback_url or callback_path

We have different strategies in an umbrella app that needs multiple to get callback in specific routes (apps). We tried change base_path, callback_url and callback_path without success.
Our Google OAuth Client contains a common Authorized JavaScript origins and multiple Authorized redirect URIs.
Our request succeeds but only on redirects to primary url.

Sending the token to a separate frontend application from Phoenix api-only app

How are we supposed to send the token to the frontend application since the frontend application will have to open a new window for Google authentication to work properly. So, when we send the token to the frontend from the new window, only the token will be rendered in the window as json.

For example, in my backend application, I ping localhost:4000/api/v1/auth/google to get the token. But when I ping it from my frontend application, which is running on localhost:3000, I get something like the following:

screen shot 2017-06-27 at 02 25 22

I'm guessing this happens because I'm not requesting it from a new window! But, if I request it from a new window, how will the token be sent to the parent window?

Release new version

It's been almost one year since the latest version, 0.7, has been released, and some bug fixes have been made since then. I think it would make sense to release the current code as the latest version on Hex.
Actually, I was struggling to deal with the problem that has been fixed by #55, as 0.7 does not include it. So, I'd appreciate if the new version will be released 😃

callback_scheme option override doesn't seem to work

I'm having issue with Error 400: redirect_uri_mismatch

The url is properly set in Google Dev Console, however uberauth seems to request the url with HTTP instead of HTTPS. Reading the source leads me to this comment where I can specify an option to override the callback scheme.

https://github.com/ueberauth/ueberauth/blob/7ebc0aeeb17d0953bdc53a01018307fb03e0b189/lib/ueberauth.ex#L182-L186

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

However the callback was still sent with HTTP. I'm using Cloudflare as https reverse proxy.

Anti-forgery state token

From what I could understand with my limited experience with elixir and phoenix, there is no anti forgery token currently created and verified, please correct me if I am wrong and didn't know where to look.

That's something that's recommended by google open id implementation guide .

You must protect the security of your users by preventing request forgery attacks. The first step is creating a unique session token that holds state between your app and the user's client. You later match this unique session token with the authentication response returned by the Google OAuth Login service to verify that the user is making the request and not a malicious attacker. These tokens are often referred to as cross-site request forgery (CSRF) tokens.

Does not work with Google Identity Service

The library does not seem to work with the rather new (Google Identity Service)[https://developers.google.com/identity/gsi/web/guides/overview].

Example of the callback request:

[info] POST /auth/google/callback
[debug] Processing with AppWeb.OauthController.callback/2
  Parameters: %{"clientId" => "xyz", "credential" => "jwt_from_google", "g_csrf_token" => "123123213", "provider" => "google", "select_by" => "btn"}
  Pipelines: [:browser]
%Plug.Conn{
  adapter: {Plug.Cowboy.Conn, :...},
  assigns: %{current_user: nil},
  body_params: %{
    "clientId" => "xyz",
    "credential" => "jwt_from_google",
    "g_csrf_token" => "1213123",
    "select_by" => "btn"
  },
  cookies: %{

So it seems nothing gets parsed and assigned to the conn.

support {:system, "X"} for provider configuration

Our use case requires configuring provider details via environment variables. Planning to fork the library and file a PR for this change, which involves changing Ueberauth.Strategy.Google.OAuth.client. Is it something you’ll take?

Thanks in advance.

Request token call failing

I'm getting the following exception / issue when the call to get an access token is made (id and secret removed by me):

Request: GET /auth/google/callback?code=4/Ra_GS_u-NB3DstQ8QjK5a7Ne9OXfsrPSY54VM0ciUSQ
** (exit) an exception was raised:
    ** (KeyError) key :access_token not found in: %OAuth2.Client{authorize_url: "/o/oauth2/v2/auth", client_id: "MY_ID", client_secret: "MY_SECRET", headers: [], params: %{}, redirect_uri: "http://2t77wg.xip.io:4000/auth/google/callback", site: "https://accounts.google.com", str
ategy: Ueberauth.Strategy.Google.OAuth, token: %OAuth2.AccessToken{access_token: nil, expires_at: nil, other_params: %{"error" => "invalid_request", "error_description" => "client_secret is missing."}, refresh_token: nil, token_type: "Bearer"}, token_method: :post, token_url: "https://www.googleapis.com/oauth2/v4/token"}
        (ueberauth_google) lib/ueberauth/strategy/google.ex:31: Ueberauth.Strategy.Google.handle_callback!/1
        (ueberauth) lib/ueberauth/strategy.ex:299: Ueberauth.Strategy.run_callback/2
        (no_maw_meetings) web/controllers/auth_controller.ex:1: NoMawMeetings.AuthController.phoenix_controller_pipeline/2
        (no_maw_meetings) lib/no_maw_meetings/endpoint.ex:1: NoMawMeetings.Endpoint.instrument/4
        (no_maw_meetings) lib/phoenix/router.ex:261: NoMawMeetings.Router.dispatch/2
        (no_maw_meetings) web/router.ex:1: NoMawMeetings.Router.do_call/2
        (no_maw_meetings) lib/no_maw_meetings/endpoint.ex:1: NoMawMeetings.Endpoint.phoenix_pipeline/1
        (no_maw_meetings) lib/plug/debugger.ex:122: NoMawMeetings.Endpoint."call (overridable 3)"/2
        (no_maw_meetings) lib/no_maw_meetings/endpoint.ex:1: NoMawMeetings.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

Not sure what's going on. I've looked around in the source code and it looks like the client_secret is being sent. I am new to Elixir!

%OAuth2.Response{status_code: 503} with no error_description in body is not handled in get_access_token

Steps to Reproduce

In our error tracker, we get sometimes see a CaseClauseError in Ueberauth.Strategy.Google.OAuth.get_access_token/2 when Google responds with a 503 error. The response's body only has an "error" key, but doesn't have the "error_description" key. Since this is an internal error from Google, we cannot reproduce it ourselves. The response looks like this:

{:error,
 %OAuth2.Response{
   status_code: 503,
   headers: [
     {"cache-control", "no-cache, no-store, max-age=0, must-revalidate"},
     {"expires", "Mon, 01 Jan 1990 00:00:00 GMT"},
     {"date", "Fri, 28 Jul 2023 16:55:20 GMT"}
	 # more headers omitted for readability
   ],
   body: %{"error" => "internal_failure"}
 }}

It fails to be matched against one of the patters from

{:error, %OAuth2.Response{body: %{"error" => error, "error_description" => description}}} ->
{:error, {error, description}}
{:error, %OAuth2.Error{reason: reason}} ->
{:error, {"error", to_string(reason)}}
{:ok, %OAuth2.Client{token: %{access_token: nil} = token}} ->
%{"error" => error, "error_description" => description} = token.other_params
{:error, {error, description}}
{:ok, %OAuth2.Client{token: token}} ->
{:ok, token}

Expected Result

The get_access_token function returns a well formatted error like in case of other handled error responses. Since the error description is missing in the response, the short error code could be repeated in place of the description.

Actual Result

A CaseClauseError is raised.

OAuth2.Error{reason: :closed} is not handled in get_access_token for Google OAuth

Steps to Reproduce

Sorry unknown steps to reproduce.

Expected Result

Error should be caught and handled.

Actual Result

We got this stack trace, which suggests that a certain class of OAuth2 error isn't being handled properly.

** (exit) an exception was raised:
    ** (CaseClauseError) no case clause matching: {:error, %OAuth2.Error{reason: :closed}}
        (ueberauth_google 0.10.1) lib/ueberauth/strategy/google/oauth.ex:54: Ueberauth.Strategy.Google.OAuth.get_access_token/2
        (ueberauth_google 0.10.1) lib/ueberauth/strategy/google.ex:45: Ueberauth.Strategy.Google.handle_callback!/1
        (ueberauth 0.7.0) lib/ueberauth/strategy.ex:364: Ueberauth.Strategy.run_handle_callback/2

The code blowing up is:

  def get_access_token(params \\ [], opts \\ []) do
    case opts |> client |> OAuth2.Client.get_token(params) do
      {:error, %{body: %{"error" => error, "error_description" => description}}} ->
        {:error, {error, description}}
      {:ok, %{token: %{access_token: nil} = token}} ->
        %{"error" => error, "error_description" => description} = token.other_params
        {:error, {error, description}}
      {:ok, %{token: token}} ->
        {:ok, token}
    end
  end

Redirect_URI not resolving correctly

Steps to Reproduce

  1. Change redirect_uri parameter to some value in config:
    config :ueberauth, Ueberauth.Strategy.Google.OAuth, redirect_uri: 'https://example.com'

  2. Check network logs

Expected Result

Expected redirect_uri to be https://example.com

Actual Result

Got redirect_uri to be http://example.com

My Suspicion

My endpoint uses HTTP and I get HTTPS throught NGINX. I think the uri is resolving to the endpoint HTTP status instead of explicitly using the string I provided it.

Deprecation warnings even after an upgrade

Hi! The project where this dependency is installed is on Elixir version 1.8.2. I have tried upgrading the version of this dependency(0.7) but the warnings persist. Does someone have insights into why this might be happening?

warning: variable "package" does not exist and is being expanded to "package()", please use parentheses to remove the ambiguity or change the variable name

warning: variable "description" does not exist and is being expanded to "description()", please use parentheses to remove the ambiguity or change the variable name

warning: variable "deps" does not exist and is being expanded to "deps()", please use parentheses to remove the ambiguity or change the variable name

warning: variable "docs" does not exist and is being expanded to "docs()", please use parentheses to remove the ambiguity or change the variable name

warning: variable "docs_extras" does not exist and is being expanded to "docs_extras()", please use parentheses to remove the ambiguity or change the variable name

Push updates to Hex

@doomspork Hi, there are fixes languishing here since Dec 2016 (e.g. Elixir 1.4 warnings). Would greatly appreciate if an update is published to Hex.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.