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

Suddenly Sign in with Twitter is not working #98

Open
anmolagar opened this issue Jun 14, 2018 · 5 comments
Open

Suddenly Sign in with Twitter is not working #98

anmolagar opened this issue Jun 14, 2018 · 5 comments

Comments

@anmolagar
Copy link

We are having issues with the Passport-Twitter auth strategy now that Twitter deployed a new callback URL setting change. Can you help us fix this as we have users who are blocked from our site. Any assistance would be much appreciated. We are trying to pass callbackURL in authentication function instead of strategy. Its been working for over 2 years until yesterday.

Here is a sample of our code:

router.get('/fan/register/twitter',
    passport.authenticate('twitter',{callbackURL: '/member/fan/register/twitter/return'})
);

// step 2
router.get('/fan/register/twitter/return',
  passport.authenticate('twitter', { failureRedirect: '/error' }),
  function(req, res) {
    
  console.log("fan register twitter with success------------------" , req.user);
  //var username = req.user._json.screen_name;
  //username = username.toLowerCase();
  req.session.twitterUser = req.user;

action-required-sign-in-with-twitter-users-must-whitelist-callback-urls

FYI, we have made all the changes in app settings as per the link above
Thanks!

@mxstbr
Copy link

mxstbr commented Jun 15, 2018

The callbackURL has to be absolute, something like: https://mysite.com/member/fan/register/twitter/return. You then have to copy and paste that exact URL into your Twitter Apps settings under "Callback URLs".

Yes, it's very annoying that you have to hard-code them now. Unfortunately, there isn't much we can do 😕

@marrs
Copy link

marrs commented Jun 19, 2018

@anmolagar did that work for you? I'm having the same issue when calling back to locally tested code. I explicitly set the callback URL as http://127.0.0.1:PORT/path/to/callback in twitter and in my code but with no change to the outcome.

@anmolagar
Copy link
Author

yeah, that worked for me.
Thanks @mxstbr
Also for mobile you need to add exact urlScheme in callback urls on apps.twitter.com for eg: myappname://
Now the problem is, i have so many different callback urls based on the functionality and twitter is limiting to only few in app settings :(

@marrs
Copy link

marrs commented Jun 22, 2018

I got it working as well. My issue turned out to be that the API keys had changed around the same time. Don't know if that was my end or Twitter's end. So failure ended up being to do with key mismatch, not callback mismatch.

@hadyrashwan
Copy link

hadyrashwan commented Sep 8, 2018

Is there is anyway around the the explicit url part . I'm authorizing the user by connecting his account to twitter so I need to send a jwt with the callback so I can match the user with his twitter account

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

4 participants