authentication.net-coresession-cookiesaccess-token

Why does my HttpOnly Flag Cookie not get saved?


I have a .Net Core Backend running and its access point for request is http://localhost:5108/graphql/

If I execute a request from this endpoint I get back the cookie and my Browser saves it.

enter image description here

If I execute this from my fronted which runs on a different Port my cookie won't get saved. My Backend and my frontend uses currently http and not https

enter image description here

Here you can see that it does not get saved: enter image description here

My cookie has the following parameters that are set in my backend:

httpOnly: true
path: "/"
samesite: "None"
secure: true

How can the frontend browser save the cookie now?


Solution

  • I solved it.

    I had to add withCredentials: true

    export function apolloOptionsFactory(): ApolloClientOptions<any> {
      const httpLink = inject(HttpLink);
      return {
        // link: httpLink.create({ uri }),
        link: httpLink.create({ uri, withCredentials: true }),
        cache: new InMemoryCache(),
      };
    }