na2hiro / remix-auth-twitter

Remix Auth plugin for Twitter OAuth 2.0 & 1.0a

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

401 Unauthorized

godd9170 opened this issue · comments

I've followed the setup guide in the readme, and upon clicking the 'Login' button, I'm taken to the /login route with the message 401 Unauthorized displayed. Unfortunately there is not much in the way of logs to troubleshoot even when I run with npx remix dev --debug. I see there are plenty of debug lines in the source code, so If you could share how to see those, it might unblock me.

What's more, is that the live demo you link in the readme also faces this same issue.

Screenshot 2023-05-22 at 10 20 38 PM

Edit:

I was able to use an ErrorBoundary to see that it's a 32 error from Twitter at play.

Screenshot 2023-05-22 at 10 28 04 PM

Thanks for the report. I confirmed that the live demo apps has been suspended due to policy violation 😅 . However, my app which uses this library is working fine.

Could you check your app's status from the Twitter's Developer Portal? https://developer.twitter.com/en/portal/dashboard

@godd9170 FWIW I had the same issue and created a "standalone app" this made it work for me. Looks like you can't use the v2 API that way, but we are only using it for authentication.
https://developer.twitter.com/en/portal/projects-and-apps
Screen Shot 2023-05-30 at 18 29 32

My suspect is that it has V1.1 verify_credentials call after getting access token, and that can cause a problem. In my app, that step started to cause a timeout.

I made a quick PR #26. I'll try to publish this as an alpha so people can try this version later today.

Published v2.0.0-0 https://github.com/na2hiro/remix-auth-twitter/releases/tag/v2.0.0-0 for the changes above. Note that this is a pre-release and you need to manually specify npm i remix-auth-twitter@2.0.0-0 in order to install. @godd9170 Can you try with this?

I see there are plenty of debug lines in the source code, so If you could share how to see those, it might unblock me.

Sorry I missed this part. It's from debug npm module and running with DEBUG=TwitterStrategy environment variable would print out which steps it gets.

^ Although it worked for me for a while, it doesn't seem to work now. 401 is returned after "Fetch access token" debug message, returned by OAuth 1.0a access token URL (/oauth/access_token)

I still don't fully understand (and some help for references would be appreciated here), but I'll try to implement another strategy with OAuth 2.0 and see if that would work

I've published an official major release 2 https://github.com/na2hiro/remix-auth-twitter/releases/tag/v2.0.0. When you have time please check if this works for you

Hi @na2hiro I apologize for going dark on this. It's part of a side project that I'd abandoned. I'll try the new release in one of the upcoming weeks, but if you want to close this issue so your backlog is pristine I'd have no issues with that.

Thanks for the update. I'll close this for now. Let me know if it still doesn't work