react-native-oauth icon indicating copy to clipboard operation
react-native-oauth copied to clipboard

Twitter POST 403: Missing required parameter: status

Open joncursi opened this issue 8 years ago • 4 comments

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 avatar Aug 21 '17 05:08 joncursi

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 avatar Aug 21 '17 07:08 joncursi

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.

joncursi avatar Oct 03 '17 13:10 joncursi

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

rperdomo avatar Dec 25 '17 16:12 rperdomo

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

Th3Ph4nt0m avatar Jan 29 '21 16:01 Th3Ph4nt0m