aspnet / AspNetKatana

Microsoft's OWIN implementation, the Katana project
Apache License 2.0
967 stars 334 forks source link

AuthenticationManager.GetExternalLoginInfoAsync() is null when requested from ios for facebook v4.1.0 #357

Closed rwcatalano closed 4 years ago

rwcatalano commented 4 years ago

I am encountering an issue. I am using 4.1.0 nuget packages to connect using the facebook login api. My facebook application is in live mode. I am able to authenticate in both local development and live modes from my laptop using chrome, edge and safari on macbook. I am unable to authenticate in live environment when using safari, chrome or duckduckgo from an apple mobile device (iphone ios v12.4.4 and ipad).

Using remote debugging I am able to see that "await AuthenticationManager.GetExternalLoginInfoAsync();" in the snippet below always returns null when attempting to connect from one of the ios mobile devices (tried using safari and chrome - both failed)

Furthermore, I am able to verify that a connection can be made using the javascript sdk from the facebook developers page on the live environment from ALL devices.

My iphone is not blocking all cookies and has cross site tracking enabled (I have tried from 3 phones and an ipad). Javascipt is enabled on the ios devices.

I have tried the "Session["Workaround"] = 0;" hack without success and I have confirmed I have the same session id from when the cookie was originated and in the callback.

Live environment is a single aws ec2 instance.

Please advise

var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); 
//loginInfo is null when called via ios device.
if (loginInfo == null) { return RedirectToAction("Login"); }

        if (string.IsNullOrEmpty(returnUrl))
            returnUrl = "/Home/Account";

        // Sign in the user with this external login provider if the user already has a login
        var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
Tratcher commented 4 years ago

The biggest change in 4.1 is around SameSite cookies which is known to have compatibility issues with some iOS versions. Please try the guidance here:

https://docs.microsoft.com/en-us/aspnet/samesite/owin-samesite

Also please share a network trace of the request and response headers if possible.

ghost commented 4 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.