Twitter Errors: Bad Authentication data - Desktop applications only support the oauth_callback

Twitter authentication error:

Errors:
{“errors”:[{“message”:”Bad Authentication data”,”code”:215}]}

Could not retrieve a valid Token response from Token URL: Desktop applications only support the oauth_callback value 'oob' /oauth/request_token?oauth_consumer_key=XXXXXXXX

If you are getting errors like above while using twitter rest API, try below solutions.
1) Change API version from 1.1 to 1.0. So in your configuration options set 'version' => '1.0'
2) Set callback URL in twitter applcation setting. Don't leave it empty.

The above should resolve the errors with twitter Rest API authentication calls.