Xamarin.Auth authentication completed callback not getting called for twitter (OAuth 1)

I'm having this code in my view controller:

authVC = service.GetAuthenticateUI((Account account) => { authVC.DismissViewController(true, null); }); PresentViewController(authVC, true, null);

the view controller gets presented correctly, i use the web view flow to auth my user with my apps consumer key and secret, and then the webview gets stuck displaying the success message. It never gets dismissed because the callback is not called apparently.

Posts

  • RockMeAmadeusRockMeAmadeus USMember ✭✭

    To answer my own question, the bug is in Xamarin.Auth as I suspected.

    OAuth1Authenticator.cs line 159

    if (url.Host == callbackUrl.Host && url.AbsolutePath == callbackUrl.AbsolutePath) {

    the static facebook page that is compared against changed hostname from

    m.facebook.com

    to

    www.facebook.com

    Also, dear @ermau, it is very confusing to debug a twitter service in Xamarin.Social and you see facebook URLs ;)

  • RockMeAmadeusRockMeAmadeus USMember ✭✭

    ... turns out it is not that reliable ;)

  • StevaSteva RSMember ✭✭✭

    This was working fine 2 weeks ago. I checked my app now and found this problem. Anyone knows how to fix this?

  • RockMeAmadeusRockMeAmadeus USMember ✭✭

    The fix is, to assign the callback url property of your xamarin social service instance object to a valid callback url. Preferably the same url you set in your oauth1 services call back url field.

    CallbackUrl = new Uri("http://someurl");

  • StevaSteva RSMember ✭✭✭

    That is true but on android it doesn't go back to sharing activity. You need to go back yourself and that is not very intuitive. And also you can't just show random page cause it will be shown in your app.

  • RockMeAmadeusRockMeAmadeus USMember ✭✭
    edited October 2013

    And also you can't just show random page cause it will be shown in your app.

    It shouldn't be a random page in the first place.

  • ChristopherDrososChristopherDrosos GRMember ✭✭
    edited October 2015

    hello @RockMeAmadeus , im having problem with twitter too on triggering the callback url. i have set both on xamarin and on twitter developer pages "http://twitter.com" but the auth.completed never gets fired, what am i missing?

    I have just try to set the callback url to mobile.twitter.com and it works, but is this safe to use? what if twitter change the default url after sign in?

  • AlexandreRobaAlexandreRoba BEMember

    Hi, I'm having the same issue with twitter. I tried to set the call back url to https://mobile.twitter.com but I always get redirected to twitter instead of going back to my app. This is very frustrating. :(

  • @Alexandre I also use same call back url to https://mobile.twitter.com it is working fine in android but in ios its always get redirect to twitter instead of app. Have any one solve this issue?

  • KevinCKevinC USMember ✭✭

    If anyone is having issues with Twitter not closing after logging in with OAuth1Authenticator, change your callback url to "https://mobile.twitter.com/home". Took me so long to find something so simple to fix this issue...

  • abdullahtahan.7433abdullahtahan.7433 SAMember ✭✭

    turns out the issue comes after version 1.3 so the best thing to do is downgrading you package

  • abdullahtahan.7433abdullahtahan.7433 SAMember ✭✭

    to hide the current page and return back to you app just type after success login ,
    viewController.DismissViewController(true, null);

  • AnkitKavdiaAnkitKavdia USMember

    Have anyone got the solution.
    In Android its working but for ios it is redirecting to twitter home page

Sign In or Register to comment.