fullstackreact / react-native-oauth

A react-native wrapper for social authentication login for both Android and iOS
https://fullstackreact.com
MIT License
801 stars 214 forks source link

Twitter POST 403: Missing required parameter: status #147

Open joncursi opened 7 years ago

joncursi commented 7 years ago

I am trying to POST to Twitter's statuses/update endpoint: https://dev.twitter.com/rest/reference/post/statuses/update

I have constructed the request in JS according to the README:

          const twitterUrl = 'https://api.twitter.com/1.1/statuses/update.json';
          const response = await manager.makeRequest('twitter', twitterUrl, {
            method: 'POST',
            params: {
              status: 'Maybe%20he%27ll%20finally%20find%20his%20keys',
            },
          });

But I am getting a 403 error: "Missing required parameter: status.". Seems like something funky is going on with the params key. Am I using it properly? Or is there a bug in the Objective C code that is making the request (https://github.com/fullstackreact/react-native-oauth/blob/master/ios/OAuthManager/OAuthManager.m#L416)? I don't know Objective C so I'm having trouble tracking this down, since everything looks right to me on the JavaScript side:

screen shot 2017-08-21 at 1 16 42 am

joncursi commented 7 years ago

I am able to make a get request to twitter no problem, so it's not a configuration issue:

const response = await manager.makeRequest('twitter', 'https://api.twitter.com/1.1/statuses/user_timeline.json');
console.log(response); // Array of objects

The problem is somewhere embedded in the fact that the above is a POST request. I have tried passing in several sets of headers:

            headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
            headers: { 'Content-Type': 'application/json' },

... but no luck. SOS! 😅

joncursi commented 7 years ago

I was able to get around this by adding the status parameter directly on the url. IE:

https://api.twitter.com/1.1/statuses/update.json?status=hello

However, I am leaving this issue open because the params key of the request object are not working as expected.

rperdomo commented 6 years ago

I thinks it is not even supported, I have tried everything without luck. Why there is no official, reply on this?

Th3Ph4nt0m commented 3 years ago

This issue is still open since 2017. It seems to be twitter-related, so it can be closed here.