ueberauth / ueberauth_github

GitHub OAuth2 Strategy for Überauth
MIT License
103 stars 53 forks source link

Broken with OAuth2 0.7 #12

Closed michalmuskala closed 7 years ago

michalmuskala commented 8 years ago

When using the new OAuth2 0.7 package I get a following error:

    ** (KeyError) key :access_token not found in: %OAuth2.Client{authorize_url: "https://github.com/login/oauth/authorize", client_id: "<SNAP>", client_secret: "<SNAP>", headers: [], params: %{}, redirect_uri: "", site: "https://api.github.com", strategy: Ueberauth.Strategy.Github.OAuth, token: %OAuth2.AccessToken{access_token: nil, expires_at: nil, other_params: %{"error" => "incorrect_client_credentials", "error_description" => "The client_id and/or client_secret passed are incorrect.", "error_uri" => "https://developer.github.com/v3/oauth/#incorrect-client-credentials"}, refresh_token: nil, token_type: "Bearer"}, token_method: :post, token_url: "https://github.com/login/oauth/access_token"}
        (ueberauth_github) lib/ueberauth/strategy/github.ex:106: Ueberauth.Strategy.Github.handle_callback!/1
        (ueberauth) lib/ueberauth/strategy.ex:299: Ueberauth.Strategy.run_callback/2
        (til) web/controllers/auth_controller.ex:1: Til.AuthController.phoenix_controller_pipeline/2
        (til) lib/til/endpoint.ex:1: Til.Endpoint.instrument/4
        (til) lib/phoenix/router.ex:261: Til.Router.dispatch/2
        (til) web/router.ex:1: Til.Router.do_call/2
        (til) lib/til/endpoint.ex:1: Til.Endpoint.phoenix_pipeline/1
        (til) lib/plug/debugger.ex:122: Til.Endpoint."call (overridable 3)"/2
        (til) lib/til/endpoint.ex:1: Til.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

Downgrading the OAuth2 library to version 0.6 works correctly.

corroded commented 8 years ago

Can confirm this is happening to me as well. I can see that this has been fixed in master but not released yet?

scrogson commented 8 years ago

@corroded correct.

sl33t commented 8 years ago

When will this be fixed/what can I do to work around it. I am working on my first phoenix project and this error is coming up on both github and googles strategies. I have been following the tutorial and was confused until I found this issue.

scrogson commented 8 years ago

@sl33t this has been updated in master on all official ueberauth_* packages. @doomspork is working on getting ready for new releases to hex soon.

Before then, you can always work from master by using the github option on the dependencies:

defp deps do
  [{:ueberauth_github, github: "ueberauth/ueberauth_github"},
   {:ueberauth_google, github: "ueberauth/ueberauth_google"}]
end

Hope that helps.

sl33t commented 8 years ago

Sweet thank you so much for the fast response.

Edit: It works you are amazing.

kelostrada commented 7 years ago

Please take a look at #15 :)