title: Use Cookies for Authentication in Azure - React Web App
body: <p>I'm trying to migrate my React-Web-Application from a normal webserver to an Azure Wep-App.
  The Application is supposed to login to my backend via email+password. This works.
  The backend sends a response with a authentication-token, which used to be saved in the cookies. The token is in the response, but it doesnt get saved.
  It doesn't throw any error or warning, neither on the browser, nor frontend logs, nor backend logs.
  I am not sure what to do, I have no clue where to start debugging. Maybe I'm using the whole Azure thing wrong?</p>
  <p>This is the code of the backend where it compares mail &amp; password with database and sends a token if everything is good:
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>async (
      req: ValidatedRequest&lt;AuthenticateRequest&gt;,
      res: Response&lt;AuthenticateResponse&gt;,
      next: NextFunction
    ): Promise&lt;void&gt; =&gt; {
      try {
        const mail = req.validData.mail;
        const password = req.validData.password;
        const user = await User.findByEmail(mail);
        if (user !== null &amp;&amp; await user.comparePassword(password)) {
          const userRole = user.association;
          // create the token
          const token = issueToken(userRole, user._id);
          
          res.cookie("cookieToken", token, {httpOnly: false});
          res.send({ user: await transformUser(user), token, });
        }
        else {
          throw new ErrorGeneric(errorCodes.ERROR_ACCOUNT_NOT_FOUND);
        }
      }
      catch (error) {
        next(error);
      }
    }</code></pre>
  </div>
  </div>
  </p>
  <p>Any ideas or help is appreciated. :)</p>
  <p>Sincerly</p>