Search code examples
asp.net.netfacebookasp.net-coreios12

cookie not in request with ios12 device


so since I upgraded my phone to ios12, I'm unable to login to a site i'm developing (.net core 2); I login via facebook, and when facebook redirects to my endpoint, the cookies are not in the request, so when this line runs:

ExternalLoginInfo info = await _signInManager.GetExternalLoginInfoAsync();

its always null, I checked the request and there is no cookies, while on other devices/pc the login works perfectly, its only ios12 thats giving me this problem atm

I saw another post that said to set cookies to SameSite = None

services.ConfigureApplicationCookie(options =>
        {
            options.Cookie.Path = "/";
            options.Cookie.SameSite = SameSiteMode.None;
            options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
            options.SlidingExpiration = true;
            options.AccessDeniedPath = "/Welcome";
        });

but this did not work, anything else I could try?


Solution

  • so I fix it, it's a similar solution but if you use external login, you have to configure the external cookie to be SameSite = SameSiteMode.None

    services.ConfigureExternalCookie(options =>
            {
                options.Cookie.SameSite = SameSiteMode.None;
            });