Set token http cookie from node.js express backend

  Kiến thức lập trình

I have hosted my application on Azure Web App. My frontend is Angular on the domain, and my backend is Node.js Express on the domain

The front end works, the backend/API works, but I have a problem with setting the HTTP cookie where I store my authentication token.

The token is generated correctly, and I set it in the following way:

res.cookie('token', token, { httpOnly: true, secure: true, SameSite: 'None', path: '/' });

I do not receive any errors in the console.

This is my web.config for the backend:

<?xml version="1.0" encoding="utf-8"?>
      <!-- Map all requests to the Node.js application -->
      <add name="iisnode" path="index.js" verb="*" modules="iisnode" />
        <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^index.js.iisnode"/>
          <action type="None"/>
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^index.js/debug"/>
          <action type="None"/>
        <!-- Redirect all non-static requests to index.js -->
       <rule name="DynamicContent">
  <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{{REQUEST_FILENAME}}" matchType="IsFile" negate="true" />
    <add input="{{REQUEST_FILENAME}}" matchType="IsDirectory" negate="true" />
  <action type="Rewrite" url="index.js" />

          <remove segment="bin" />
    <iisnode watchedFiles="web.config;*.js" />

This is my cors

const corsOptions = {
    origin: [''],
    credentials: true,

How do I send the cookie so that it is saved in the user’s browser? Everything works without any issues on localhost.

I want to set http cookie into browser on azure web app.