XF 1.4 Twitter Integration

What may cause using the "Log in with Twitter" button on the log-in form to work intermittently?

When using (testing) this feature, occasionally I will receive "An unexpected error occurred. Please try again later.", however, when trying again a few seconds later it will work as expected (requesting permission on Twitter).

One more thing, assuming everything works as expected, and you decide not to go ahead with the authorisation, and you click "Cancel", and then "Return to [site]", it will redirect you to an error message: "An unexpected error occurred. Please try again later".

I disabled all add-ons on my site, and it was still performing intermittently - sometimes taking me to Twitter, sometimes returns with the error. (I kept trying it for a while with add-ons disabled.)

Then I re-enabled add-ons, with the same result. A while later, it began working more solidly, but I observe it still returns the error maybe 10% of the time.

There were no server error logs, apart from three all the same. I received these ones before disabling add-ons (before posting this thread) during one of the times it *did* successfully take me to Twitter. When I clicked "Sign In", it redirected me to my site, with the error here:

Server Error

Error in HTTP request

Zend_Oauth_Http->startRequestCycle() in Zend/Oauth/Http/AccessToken.php at line 51
Zend_Oauth_Http_AccessToken->execute() in Zend/Oauth/Consumer.php at line 225
Zend_Oauth_Consumer->getAccessToken() in XenForo/ControllerPublic/Register.php at line 803
XenForo_ControllerPublic_Register->actionTwitter() in XenForo/FrontController.php at line 347
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
XenForo_FrontController->run() in ../index.php at line 13

I missed that comment about this site. It isn't designed, but if it is taking ~10 seconds to redirect back when it does work, it is likely some service issues with Twitter that are ultimately outside the control of the software.

Some other details:
- The forum in which this is occurs is running XenForo 1.4.2.
- I have received this error when all add-ons were disabled.
- I created a test forum on the same server and did not receive any errors. The Twitter integration worked well each time I tried it (of course, modifying the Website URL value within the Twitter App Settings.). I had no errors on the separate test forum. The test forum I created was using XenForo version 1.4.3 (I haven't had opportunity to check if anything was changed - just a thought.)

I have again reached the problem detailed above when attempting to use the in-built Twitter integration using PHP 5.6.0 (this is on a Windows server, and it's a separate instance to my live forum which has used this feature on PHP 5.3 and 5.4 without any problems).

Running the Twitter Integration test (?tools/test-twitter) returns in one of a series of errors:

Either simply:

Twitter returned the following error: Error in HTTP request.

Click to expand...

Or something similar to this:

Twitter returned the following error: Could not retrieve a valid Token response from Token URL: <?xml version="1.0" encoding="UTF-8"?> <hash> <error>Desktop applications only support the oauth_callback value 'oob'</error> <request>/oauth/request_token?oauth_consumer_key=5BuAZ8mDivYxe6hBPS1l32MBh&amp;oauth_nonce=9ec132adc8c2a5ab536c540f1llaf398&amp;oauth_timestamp=1424536482&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_version=1.0&amp;oauth_callback=http%3A%2F%2Fexample.com%2Fadmin.php%3Ftools%2Ftest-twitter&amp;oauth_signature=w9D5bqpOMl9dCg3vMmt6806MyBk%3D</request> </hash> .

Click to expand...

I do not believe it to be a problem with my Twitter app settings.
The test forum on which I am trying this on does not have any add-ons installed (XF 1.4.3).

(A similar problem occurs with the Facebook integration feature - errors are returned instead of the integration being successful.)

Just to note that on the occasions it does work, clicking on 'Run Test' does not immediately direct me to Twitter/Facebook to authenticate - it hangs for a while, then either takes me to Twitter/Facebook or produces the error similar to above.

It seems like there are outgoing connectivity issues -- both of those errors seem to point to that. Unfortunately it's hard to say what specifically would be causing that. It's lower level than XenForo (it's mostly related to your network stack).