ueberauth / ueberauth_github

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

function Poison.decode!/1 is undefined -> issue with oauth2 v0.9.2 #43

Closed caspg closed 5 years ago

caspg commented 6 years ago

I'm getting following error when using with oauth2 v0.9.2.

** (UndefinedFunctionError) function Poison.decode!/1 is undefined (module Poison is not available)
        Poison.decode!("{\"error\":\"bad_verification_code\",\"error_description\":\"The code passed is incorrect or expired.\",\"error_uri\":\"https://developer.github.com/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#bad-verification-code\"}")
        (oauth2) lib/oauth2/response.ex:32: OAuth2.Response.new/3
        (oauth2) lib/oauth2/request.ex:80: OAuth2.Request.process_body/3
        (oauth2) lib/oauth2/client.ex:231: OAuth2.Client.get_token/4
        (oauth2) lib/oauth2/client.ex:246: OAuth2.Client.get_token!/4
        (ueberauth_github) lib/ueberauth/strategy/github/oauth.ex:65: Ueberauth.Strategy.Github.OAuth.get_token!/2

ouath2 removed Poison from dependencies (changelog) but it is still configured as a default serializer.

Adding Poison to dependencies (ueberauth_github or to my phoenix app) solves this problem. Another way is to configure oauth2 (click) serializer and use for example Jason which comes by default with Phoenix.

Is there any info about it that I missed? If not, it could be useful to add it to the README.

scrogson commented 6 years ago

oauth2 doesn't include Poison because the serializers are configurable. It only configures Poison by default as a convenience. You still need to include it in your app.

I do have this PR that I've posted for over a year and I haven't merged it yet: https://github.com/scrogson/oauth2/pull/92

I guess I'm still waiting for feedback from the community on whether it's a good approach or not.

smartdevbr commented 5 years ago

I've solved this problem just including {:poison, "~> 3.1"} on my dependencies.

the-pat commented 5 years ago

Is there a reason we're required to use Poison when the we can customize the serializer for Ueberauth (with the default being Jason)?