linvi / tweetinvi

Tweetinvi, an intuitive Twitter C# library for the REST and Stream API. It supports .NET, .NETCore, UAP (Xamarin)...
MIT License
1k stars 220 forks source link

TweetInvi.AuthFlow.InitAuthentication returns null #724

Open vinceweeks opened 6 years ago

vinceweeks commented 6 years ago

Our company has a web app that integrates with twitter . Well, it used to. Our implementation was working up until 06-18-2018. Our implementation was created using the examples and TweetInvi. It's hard to tell, but it looks like twitter is making some changes. I've added "real" callback URLs at apps.twitter.com - that seemed to be most people's fix. Didn't work for me. Can't find a way to contact a developer at twitter - anyone have any suggestions?

MayakoAelys commented 6 years ago

Hi @vinceweeks

Since we don't see your code, it can be difficult to help you but I'm going to try

You need to make sure that you give the full URL where Twitter will send back its values to be able to authenticate your users again. You also need to specify the port if you have one in your endpoint.

The following works fine in my case: image

As my webapp listen to the /Twitter/Validate endpoint, I had to give this path to Twitter.

vinceweeks commented 6 years ago

Thanks for getting back to me. here's an example of one of our callback URLs: https://trackmypos.com/Twitter/Confirmation - No port number - this URL had been working but now it does not. Any other suggestions?

vinceweeks commented 6 years ago

I can show code if you need to see it - my point is, our code was working, hadn't been changed in probably six months and now does not work.

MayakoAelys commented 6 years ago

It was working before because Twitter asked for a url without really verifying it, it changed recently and you now need to give the exact urls used by your webapp to validate the authentication request. If I'm not wrong you also need to take care to write the http and https if both are accessible on your website.

In my case, the authentication flow goes like this:

1. /Home/Index
2. Clicking on login button -> redirect to /Twitter/Auth which redirect the user to Twitter
3. <twitter login> -> redirect to /Twitter/Validate
4. /Twitter/Validate set some cookies then redirect to /Home/Menu

So I had to put https://<my website>/Twitter/Validate has a callback url to tell Twitter to allow this URL for the logging function.

vinceweeks commented 6 years ago

Hi Lynn – I couldn’t make it work – I changed our approach to just make the required REST calls. Thanks for getting back to me.

From: Lyyn notifications@github.com Sent: Wednesday, June 27, 2018 12:58 AM To: linvi/tweetinvi tweetinvi@noreply.github.com Cc: Vince Weeks vweeks@workwelltech.com; Mention mention@noreply.github.com Subject: Re: [linvi/tweetinvi] TweetInvi.AuthFlow.InitAuthentication returns null (#724)

It was working before because Twitter asked for a url without really verifying it, it changed recently and you now need to give the exact urls used by your webapp to validate the authentication request. If I'm not wrong you also need to take care to write the http and https if both are accessible on your website.

In my case, the authentication flow goes like this:

  1. /Home/Index

  2. Clicking on login button -> redirect to /Twitter/Auth which redirect the user to Twitter

  3. -> redirect to /Twitter/Validate
  4. /Twitter/Validate set some cookies then redirect to /Home/Menu

So I had to put https:///Twitter/Validate has a callback url to tell Twitter to allow this URL for the logging function.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/linvi/tweetinvi/issues/724#issuecomment-400578796, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIIWzGo439_5gCurVnkzAwbVcSi-K90oks5uAzr8gaJpZM4U29IE.

linvi commented 6 years ago

Hello,

If you have question for the twitter team I would suggest you go on the developer forum https://twittercommunity.com. They usually reply.

I would suggest that you put the real url in your callbacks and try to reset your app credentials. If this is not working try the same thing with a different app just in case your application got blocked by Twitter bot detection.

Let me know if this helped in any way.

linvi commented 6 years ago

You can also have a look here : https://github.com/linvi/tweetinvi/issues/718

They seemed to be experiencing the same problem.