commit 2f834c13589ae03bf4b1e3acfcaed042d4489d73
parent 05a58995cfbc57b0865270b82468d00fbf93a467
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Wed, 18 Sep 2024 22:30:23 +0200
fix(magic): strict sameSite cookie
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/AuthVerify.jsx b/src/AuthVerify.jsx
@@ -1,5 +1,6 @@
import { useState, useEffect } from 'react'
import { CookiesProvider, useCookies } from 'react-cookie'
+import { redirect } from "react-router-dom"
const api_uri = import.meta.env.VITE_API_URI
const api_port = import.meta.env.VITE_API_PORT
@@ -23,13 +24,13 @@ function AuthVerify() {
// Set client session (https://www.npmjs.com/package/react-cookie)
setSession('auth', data, {
path: '/',
- sameSite: true,
+ sameSite: 'strict',
secure: process.env.NODE_ENV !== 'development',
maxAge: parseInt(session_ttl),
})
// redirect if everything ok
- window.location.replace('/');
+ return redirect("/");
}
})();
}, []);