Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Not found. Authentication passthru" error when trying to connect Twitter / X service #3405

Open
BackedUpBooty opened this issue May 6, 2024 · 2 comments

Comments

@BackedUpBooty
Copy link

Running Huginn in docker, I've seen some similar issues from years ago but I couldn't find a resolution on them.

I followed the setup instructions for adding the env variables for Twitter/X oauth (HUGINN_TWITTER_OAUTH_KEY/SECRET). My huginn domain is accessible remotely with no restrictions on Cloudlfare's side or my side. When attempting to connect the service through Huginn by clicking the 'Authenticate with Twitter' button I get a Not found. Authentication passthru error at the URL which is https://huginn.mydomain.com/auth/twitter. I have a local DNS redirect for my domain, it happens both inside and outside my LAN. I saw that someone mentioned it could be browser-related. I've tried with opera, firefox and chrome and got the same response.

Steps I've taken:

  • Created a project in X
  • Added https://huginn.mydomain.com/auth/twitter/callback to the redirect on X
  • 'App permissions' are set to Read and 'Type of App' to Web App
  • Added the API and secret to the relevant OAUTH_KEY/SECRET variable
  • Tried using the consumer API + secret, the access bearer token and secret, and the OAuth 2.0 Client ID and Client Secret (I saw that there had been some info a few years back about OAuth 1.0 vs 2.0, see image below for confirmation of v2 API on the eproject)
    image

Logs:
Relevant logs for inside the LAN:

foreman stdout | 12:50:35 web.1  | I, [2024-05-06T05:50:35.909608 #599]  INFO -- : [9a341620-bf84-488c-b661-fb55c9c9b389] Started GET "/auth/twitter" for 192.168.1.11 at 2024-05-06 05:50:35 -0700
foreman stdout | 12:50:35 web.1  | I, [2024-05-06T05:50:35.911789 #599]  INFO -- : [9a341620-bf84-488c-b661-fb55c9c9b389] Processing by OmniauthCallbacksController#passthru as HTML
foreman stdout | 12:50:35 web.1  | I, [2024-05-06T05:50:35.914754 #599]  INFO -- : [9a341620-bf84-488c-b661-fb55c9c9b389]   Rendered text template (Duration: 0.0ms | Allocations: 3)
foreman stdout | 12:50:35 web.1  | I, [2024-05-06T05:50:35.915261 #599]  INFO -- : [9a341620-bf84-488c-b661-fb55c9c9b389] Completed 404 Not Found in 3ms (Views: 1.8ms | ActiveRecord: 0.0ms | Allocations: 612)

and outside the LAN

foreman stdout | 12:59:26 web.1  | I, [2024-05-06T05:59:26.501416 #599]  INFO -- : [45a89f54-1a84-4586-ba23-ee7134d69ed1] Started GET "/auth/twitter" for 133.159.[redacted] at 2024-05-06 05:59:26 -0700
foreman stdout | 12:59:26 web.1  | I, [2024-05-06T05:59:26.504086 #599]  INFO -- : [45a89f54-1a84-4586-ba23-ee7134d69ed1] Processing by OmniauthCallbacksController#passthru as HTML
foreman stdout | 12:59:26 web.1  | I, [2024-05-06T05:59:26.504806 #599]  INFO -- : [45a89f54-1a84-4586-ba23-ee7134d69ed1]   Rendered text template (Duration: 0.0ms | Allocations: 1)
foreman stdout | 12:59:26 web.1  | I, [2024-05-06T05:59:26.505067 #599]  INFO -- : [45a89f54-1a84-4586-ba23-ee7134d69ed1] Completed 404 Not Found in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms | Allocations: 179)

which would explain the 'Not found' error in the browser, but I can't figure out why. I couldn't find any other helpful logs when bashing into the container, though I may have just not found the right path (I found supervisord.log but it wasn't any help). Am I missing something in the container setup?

Environment in the compose is as follows (passed from a .env, though I've also tried the keys as explicit in the compose with the same outcome):

    environment:
      - DATABASE_HOST=huginn-mysql
      - DATABASE_NAME=$MYSQL_DATABASE
      - DATABASE_USERNAME=$MYSQL_USER
      - DATABASE_PASSWORD=$MYSQL_PASSWORD
      - SMTP_DOMAIN=$SMTP_DOMAIN
      - SMTP_USER_NAME=$SMTP_USER_NAME
      - SMTP_PASSWORD=$SMTP_PASSWORD
      - SMTP_SERVER=$SMTP_SERVER
      - SMTP_PORT=$SMTP_PORT
      - SMTP_AUTHENTICATION=$SMTP_AUTHENTICATION
      - SMTP_ENABLE_STARTTLS_AUTO=$SMTP_ENABLE_STARTTLS_AUTO
      - SMTP_SSL=$SMTP_SSL
      - EMAIL_FROM_ADDRESS=$EMAIL_FROM_ADDRESS
      - HUGINN_TWITTER_OAUTH_KEY=$TWITTER_OAUTH_KEY
      - HUGINN_TWITTER_OAUTH_SECRET=$TWITTER_OAUTH_SECRET

I also wiped the database and started with a new one with the Twitter OAUTH included from the beginning, just in case.

Thanks for any assistance and apologies if I've missed something super obvious.

@shengliangd
Copy link

Facing similar problem, no solution found yet.

@virtadpt
Copy link
Collaborator

I think this has to do with the Twitter API changing, but the Ruby gems that interact with it not being updated. Some of the changes have to do with API use pricing changing (there's very little you can do from the free tier, as of 2023), some of it is how unstable the API service as a whole has been for a while, some of it is that you have to look at the raw error messages now to see what's going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants