ueberauth / ueberauth_twitter

Twitter Strategy for Überauth
MIT License
36 stars 38 forks source link

Could not authenticate you. (Code 32) #48

Open shahryarjb opened 2 years ago

shahryarjb commented 2 years ago

Steps to Reproduce

I added all the config README into my project, but I get Could not authenticate you. (Code 32) error when I want to redirect to twitter


Actual Result

** (exit) an exception was raised:
    ** (Ueberauth.Strategy.Twitter.OAuth.ApiError) Could not authenticate you. (Code 32)
        (ueberauth_twitter 0.4.1) lib/ueberauth/strategy/twitter/oauth.ex:82: Ueberauth.Strategy.Twitter.OAuth.request_token!/2
        (ueberauth_twitter 0.4.1) lib/ueberauth/strategy/twitter.ex:18: Ueberauth.Strategy.Twitter.handle_request!/1
        (mishka_social 0.1.0) lib/auth/handel_request.ex:10: MishkaSocial.Auth.HandelRequest.handle_social_sender/1
        (mishka_html 0.1.0) lib/mishka_html_web/controllers/auth_controller.ex:1: MishkaHtmlWeb.AuthController.action/2
        (mishka_html 0.1.0) lib/mishka_html_web/controllers/auth_controller.ex:1: MishkaHtmlWeb.AuthController.phoenix_controller_pipeline/2
        (phoenix 1.6.6) lib/phoenix/router.ex:355: Phoenix.Router.__call__/2
        (mishka_html 0.1.0) lib/plug/error_handler.ex:80: MishkaHtmlWeb.Router.call/2
        (mishka_html 0.1.0) lib/mishka_html_web/endpoint.ex:1: MishkaHtmlWeb.Endpoint.plug_builder_call/2
        (mishka_html 0.1.0) lib/plug/debugger.ex:136: MishkaHtmlWeb.Endpoint."call (overridable 3)"/2
        (mishka_html 0.1.0) lib/mishka_html_web/endpoint.ex:1: MishkaHtmlWeb.Endpoint.call/2
        (phoenix 1.6.6) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.9.0) /Users/shahryar/Desktop/mishka-cms/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.9.0) /Users/shahryar/Desktop/mishka-cms/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.9.0) /Users/shahryar/Desktop/mishka-cms/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 3.16.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

I do not know this PR https://github.com/ueberauth/ueberauth_twitter/pull/38 fix this or not, it has conflict and I think it is old. It should be noted, GitHub and google work.

michelson commented 2 years ago

same error here, did you find a solution?

benvp commented 2 years ago

This is because you are probably using the clientId and clientSecret which is provided by twitter. This lib expects the consumer_key and consumer_secret.

Also make sure that you have "Elevated Access" with your Twitter API (by requesting it), so that you can Sign In via OAuth1.

michelson commented 2 years ago

I've created a Twitter implementation for the v2.0, it uses the oauth2 package: https://github.com/rauversion/rauversion-phx/tree/main/lib/rauversion/ueberauth/twitter It lives on a repo right now but I guess it could be extracted to a new package. What do you think?

yordis commented 2 years ago

Maybe create a PR @michelson I am not too familiar with the twitter details so help is much appreciate here

michelson commented 2 years ago

how should this PR be designed in order to support both versions? maybe a TwitterV2 module? twitter_v2/folder? maybe it would make more sense to create a new package? let me know.

yordis commented 2 years ago

ideally avoid breaking changes, is this because of two different APIs? In that case, yeah, probably create a different module until we can deprecate the old one.

Any idea about the deprecation from Twitter? What is the EOL of it?

michelson commented 2 years ago

ideally avoid breaking changes. Is this because of two different APIs? In that case, yeah, probably create a separate module until we can deprecate the old one.

Any idea about the deprecation from Twitter? What is the EOL of it?

The V1 will not be deprecated AFAIK, so that a different module will be needed.

benvp commented 2 years ago

ideally avoid breaking changes. Is this because of two different APIs? In that case, yeah, probably create a separate module until we can deprecate the old one.

Any idea about the deprecation from Twitter? What is the EOL of it?

The V1 will not be deprecated AFAIK, so that a different module will be needed.

Exactly. Quite a few endpoints are still v1 only (e.g update_profile) so a v2 package is preferable I think.