Why am I getting Bad Authentication Data (Error 215) when using Abraham's twitteroauth?


I’ve been using Abraham’s twitteroauth for over a year, and it has worked perfectly for API v1. However, since changing to v1.1 (just changing <public $host = “https://api.twitter.com/1/”;> to <public $host = “https://api.twitter.com/1.1/”;>) I have noticed many Bad Authentication Data errors (Error 215). This error does not happen all the time, but it does happen very often.

What can I do to eliminate this error?


Are you getting the 215 errors consistently for specific API methods, requests authenticated from specific users, or requests for specific users data?

One of the big changes for v1.1 was requiring auth for all requests. It might be that invalid auth was getting ignore for requests that didn’t require auth on v1 and are now getting rejected on v1.1.


Supposedly v1.1 is way more strict than v1. I read a response somewhere that changing the header content_type helped fix things:

“Content-Type: application/x-www-form-urlencoded”

However I’m not quite sure how to integrate this change into the library. I’m not even positive that it will fix the 215 error, but I have a feeling it could be one of the issues. Maybe you can help with this @abraham ?

Also changing twitteroath.php’s accessTokenURL() function to function accessTokenURL() { return ‘https://api.twitter.com/oauth/access_token?oauth_verifier=’.$_REQUEST['oauth_verifier’]; } gets rid of an oauth_verifier error that some are encountering, including myself.


Dear Tariq

I am facing a similar issue, may I know if you have resolved it?