Twitter plugin error.

Plugin.twitter now displays an error several days ago.

Before that it worked fine.

TWITTER PLUGIN ERROR: Unable to obtain oAuth request token. Please double-check your API key and API secret.

It seems to be an error to execute.

twitter.login (function () twitter.getUser (callback) end)

The API key and API secret is set without any problem.

twitter = require "plugin.twitter" twitter.showAlerts = true twitter.init ("API KEY", "API SECRET")

Does anyone know something?

Hi @umalemon,

I’m not sure what’s going on, but I’m also able to reproduce this error with my demo app, so it seems something changed on the Twitter side of things. I’ll start investigating and will report back on this thread when I know more.

Thank you.

Maybe I think it’s a problem due to Twitter’s specification change.

Is this helpful?

https://twitter.com/TwitterAPI/status/1006635008692350977?ref_src=twsrc%5Etfw&ref_url=http%3A%2F%2Fpronama.azurewebsites.net%2F2018%2F06%2F13%2Ftwitter-oauth-callback-url%2F

@umalemon,

Yes, that is the cause (we must have discovered it at the same time). When logging in, the plugin uses a webview to allow the user to enter their credentials, and that webview currently specifies a callbackURL of “returnToApp”, which I listened for in a URL listener and knew to close the webView when that URL was requested. But now that Twitter enforces whitelisting, I’ll need to update the plugin to allow you to specify a callbackURL in twitter.init(), that matches one of your whitelisted callback URLs.

I’ll try to get an updated version of the plugin released ASAP. Thanks for bringing this to my attention, and sorry for the hassle.

Best,

Jason

thank you for investigating.

I appreciate your plug-in.

I will wait :slight_smile:

Hi @umalemon - I have fixed this and pushed up a new version of the plugin to the store repository. It could take an hour or two to be available, but once it is you’ll be able to specify your whitelisted Callback URL in twitter.init() and everything should be hunky-dory.

The new syntax for twitter.init() is:

twitter.init("api\_key", "api\_secret", "callback\_url")

Just make sure that your callback URL is included in your app settings at apps.twitter.com, and that you enter it exactly how it appears there.

This update also includes something I wrote a while ago based on user feedback but had been sitting on: application-only authentication. This means that if you’re making requests to Twitter that are not tied directly to the user (searching, etc), you don’t need to call twitter.login() first - it will simply authenticate based on your Twitter app. This is not a breaking change, though - you don’t need to use it if you don’t want to.

Thank you!

It works without problems.

Please keep doing a good job.