Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Philip Hayton 98 posts 435 karma points
    Mar 22, 2023 @ 20:55
    Philip Hayton
    0

    Set cookie domain for members

    Hi guys,

    Does anyone know how to set the cookie domain for front end members? I want the cookie to be for the top level domain:

    mydomain.com but it's currently using the subdomain api.mydomain.com.

    PS I'm using Umbraco 11.

  • Rob 2 posts 72 karma points
    Sep 19, 2023 @ 14:40
    Rob
    0

    Hi Philip, did you ever get this resolved? I'm using Umbraco 10 and facing the same issue. We have an API logging the user in but the cookie is returning with the domain "mysite.com" but it's not letting me configure it to allow subdomains, e.g. "test.mysite.com". It seems to be strictly set to whichever domain is handling the authentication. I did manage to change the lifespan of the cookie with:

    services.ConfigureApplicationCookie(options =>
    {
         options.ExpireTimeSpan = TimeSpan.FromDays(365);
    }
    

    but this seems to be ignoring "options.Cookie.Domain = ".mysite.com"

    Any help with this would be greatly appreciated. Thanks.

  • Philip Hayton 98 posts 435 karma points
    Sep 22, 2023 @ 07:30
    Philip Hayton
    0

    Hi Rob,

    Unfortunately I've not managed to find a solution yet. I needed it for a proof of concept that has since been parked, but it would be good to know if this is possible for future.

    It may be worth opening an issue on the GitHub repo.

    If you do open a ticket drop a link here and I'll subscribe to it 👍🏻

    Cheers & good luck!

Please Sign in or register to post replies

Write your reply to:

Draft