nango icon indicating copy to clipboard operation
nango copied to clipboard

Twitter requests return "Could not authenticate you"

Open Nmaxime opened this issue 3 years ago • 4 comments

Any help would be very appreciated :)

Problem

When I query the twitter api through the pizzly proxy, I get this error :

Object
errors:Array[1]
0:Object
code:32
message:"Could not authenticate you."

Steps to reproduce

  • deploy Pizzly on platform.sh or run it locally
  • Create a Twitter developer account and a twitter app with 3-legged OAuth enabled and callback urls configured
  • Setup a twitter configuration in pizzly
  • In Authentications tab, connect to twitter
  • Use the generated authId to query "statuses/home_timeline.json" or "statuses/user_timeline.json?screen_name=twitterapi&count=2"

Nmaxime avatar Apr 20 '21 17:04 Nmaxime

Not sure why this is happening. I'm seeing it too when testing a new account, but it certainly worked fine in the past. Perhaps something with changes to their auth or config with the new v2 API.

markmichon avatar Apr 22 '21 23:04 markmichon

I find out the solution, pizzly query parameters need to be removed before calling the twitter API :

https://github.com/Bearer/Pizzly/blob/master/src/lib/proxy/index.ts#L160 https://github.com/Bearer/Pizzly/blob/master/src/lib/proxy/index.ts#L67

Nmaxime avatar Aug 31 '21 12:08 Nmaxime

@maximeNaulleau did you resolve the issue, even when I do my own curl call, the authentication tokens provided by twitter do not work

TanAidan avatar Sep 27 '21 04:09 TanAidan

@TanAidan , I replaced the oauth library used for oauth1 with this one : https://www.npmjs.com/package/oauth-1.0a You can easily read the source code and get any information you need for your curl call. Be sure that pizzly_* params are not included during the signature generation.

Nmaxime avatar Sep 27 '21 12:09 Nmaxime