huginn: Can't authenticate with Twitter

Twitter’s new API has two sorts of keys/secrets for apps. For example (note: not valid keys 😄):

Consumer API keys

  • H3ihdVN4SZOGuPAodO93rRaGY (API key)
  • 1tcII3HFtNAlRGVWGwoxS9reNAVD3CK8heyi5hdpbcC0MxbN5r (API secret key)

Access token & access token secret

  • 26478024-DE1jNpp0OaVcWY3GKr07iDUtGQ8nBCrCblBsNdWic (Access token)
  • Ce2QgHZoKBpDP7PKKuOWOAChcKCqfExHKayuM9myCAyTf (Access token secret)
  • Read-only (Access level)

I’ve tried plugging both kinds into my .env file (restarting Huginn after) thusly:

TWITTER_OAUTH_KEY=H3ihdVN4SZOGuPAodO93rRaGY
TWITTER_OAUTH_SECRET=1tcII3HFtNAlRGVWGwoxS9reNAVD3CK8heyi5hdpbcC0MxbN5r

When I click the “Authenticate with Twitter” button on my Services page, I get “We’re sorry, but something went wrong.” from Huginn. The production.log has OAuth::Unauthorized (401 Authorization Required) for the “Consumer API key”, and the “Access token” version gives a log entry with OAuth::Unauthorized (403 Forbidden).

Any clues?

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 4
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Greetings Tom,

I was having the same problem so as a temporary workaround I started using Twurl. If you don’t have a shared Huginn instance you can do that too. I blogged about it here: https://antranigv.am/weblog_en/posts/2022/03/tweeting-with-huginn-and-twurl/

I’m not sure that the actual problem is, since Huginn is not displaying any errors. It might be a change in Twitter’s API.

Currently I’m trying to deploy older versions of Huginn and see when it broke to check the code change.

Kind regards,

— Antranig Vartanian https://antranigv.am/ PGP Key ID: 0x2D59F21C

On 6 Apr 2022, at 5:07 PM, Tom Earl @.***> wrote:

Hi folks 👋

Also having the problem mentioned above - please let me know if there’s anything I can provide that’d be useful for troubleshooting.

When I follow the “Authenticate with Twitter” button on the Services tab, I’m taken to the Twitter API authorization page where I enter my Twitter credentials. It then redirects me back to my huginn Services page but the service doesn’t actually get added.

(/cc @dsander)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Hmm can you post the output from the production log or the docker logs (depending on your setup)?

@MTStrothers The DOMAIN should be the URL how you are reaching Huginn, this could be the domain name or IP including the port. Assuming your are running Huginn on 127.0.0.1 with port 3000 the callback URL on twitter should be http://127.0.0.1:3000/auth/twitter/callback