Update Twitter Status giving error


(Charlotte Westney) #1

Hi everyone,

 

I've got a trigger which used to work fine, but has stopped sending out tweets.

The trigger fires on an 'after asset built' event, after an image is uploaded on an asset builder page. It sends me an email (that bit still works) and then has an Update Twitter Status action, which has stopped working.

(I'm not sure when it stopped working, as the asset builder page is only used over winter).

 

I've logged into dev.twitter.com and have regenerated the consumer key and secret, put these into the trigger action, and then I get this error:

 

Error: failed to gain request token A request for a request token failed. URL: https://api.twitter.com/oauth/request_token, HTTP Code: 0, Error:

 

 

Matrix version: 4.18.6 - so from what I've read on here this version is using the new https url, and the error seems to show that too.

 

What do I need to do to get this working again - should this trigger action still work with Twitter's new API?

 

Thanks!
Charlie.


(Tom Chadwin) #2

My guess is that it was built with the old Twitter API. I'm not sure of the differences, but it's not just whether it's HTTPS or not. Is it something to do with OAUTH (or OAUTH2, or something - can't remember)? Might need a bit of rebuilding.

 

Can anyone else confirm how to check which API version the trigger is currently calling, and therefore whether that is the issue?

 

Thanks

 

Tom


(Nic Hubbard) #3

My guess is that it was built with the old Twitter API. I'm not sure of the differences, but it's not just whether it's HTTPS or not. Is it something to do with OAUTH (or OAUTH2, or something - can't remember)? Might need a bit of rebuilding.

 

Can anyone else confirm how to check which API version the trigger is currently calling, and therefore whether that is the issue?

 

Thanks

 

Tom

 

I think this is was also causing my issue with not being able to redirect to Twitter for authentication. I have seen this on the NPA server as well as some newer 5.x installs.

 

I hope there is a patch for this soon!


(Charlotte Westney) #4

Squiz chaps - any update on this one? Is there a known issue with Matrix and the new Twitter API, is there a patch on the way?

Thanks! C.


(Anthony Ponomarenko) #5

Hi Charlie, 

 

Sorry about the delay. We have identified that there is a fault and have escalated it to our developers. 

 

Hopefully we should know more about the issue soon.


(Anthony Ponomarenko) #6

I have actually been able to resolve the issue i was having, i missed the Callback url in my Twitter settings.

 

Edison will reply soon with some more detail to help you resolve the issue.


(Edison Wang) #7

Anthony Ponomarenko and I both tested setting up new Twitter integration on different Matrix instances and all work fine.

An existing integration (a Trigger action to update status) on my local system still works fine.

I can't see there is any problem with it.

 

One thing i'd like to clarify is that, do not use the new Oauth 2 Token asset in Matrix, Twitter doesn't fully support Oauth 2. It just supports Oauth 1.1.

So just stick with the REST Resource Oauth Session asset that uses Oauth 1.1 standard.

 

What happened to Charlie W and Nic Hubbard are probably different.

Charlie W had a sudden break on an existing integration (already had a stored Access Token). This indicates some external factors  changed caused this.

Nic Hubbard could not set up a new integration ( failed to get Request Token), this usually means incorrect configuration on Twitter side or Matrix side.

 

 

I have below suggestions:

 

for Nic Hubbard,

It happens to me a few times before too, but all turns out to be config issue. Some common cases:

- The Consumer Key, Consumer Secret and those Token URLs pasted in Matrix are incorrect. Sometime it has trailing/heading spaces when i paste the details from Twitter site. - The Redirect URL filled in Matrix and settings in Twitter is blank or doesn't match.
In twitter apps  site (http://apps.twitter.com/), your app needs to have a Redirect back URL set and this URL should be same or at least the parent domain of the Redirect URL you filled in Matrix end.

- Check your Matrix proxy settings. Try to disable them but still allow Matrix to make connection to twitter site.
Once your have Access Token acquired, you can turn off the connection again.

- Some settings on Matrix Oauth asset to check

 -- should use POST as default method

 -- redirect to authorize should be yes by default

 -- try to apply a blank design or no design

 

 

 

for Charlie W

 

Try to think hard what has been changed around the time the integration was broken.

Any server setting changed? Anyone changed Twitter app setting on Twitter site?

 

Note that,  the Access Token Twitter grants, never expires,  You can only manually revoke it on http://apps.twitter.com/.

The trigger action stores the granted Access Token. So most likely it's some external factors got changed.

 

If you  regenerated a new Consumer Key and Secret, you have to update that Matrix Trigger and set up the integration again to get a new Access Token.

 

 

 

If you are familiar with PHP code. You can use below code to dump out the full communication Matrix had with twitter token API to help understanding what happened.

in core/attributes/oauth/oauth.inc, find function getRequestToken and getAccessToken.

After the line $this->_performRequests(); 

insert below log dump code

log_dump($this->_res);

 

This will dump out the communication details to Matrix error log.

 

For those not familiar with Oauth, In a Oauth integration, app gets a Request Token first, and then redirect to the Twitter site with Request Token for authentication, after authentication redirected back to Matrix, finally Matrix will use the authentication response to get a permanent Access Token. The Access Token is used as authentication token to make REST API calls to Twitter.

 

Without getting access to your instance and debug the issue myself, i can't say for sure.
Hope my comment helps.