Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

using backend specified expiresIn property

Blue Mouse9bb3de06d4a0
diff --git a/src/redux/sagas/auth/workers/sso_auth.ts b/src/redux/sagas/auth/workers/sso_auth.ts
index 6d03fcd84..bc1b2cba7 100644
--- a/src/redux/sagas/auth/workers/sso_auth.ts
+++ b/src/redux/sagas/auth/workers/sso_auth.ts
@@ -35,16 +35,15 @@ export default function* ssoAuth({ payload: { callback, dontRemember, t } }: ISS
}
try {
- const { uuid, auth_url: authUrl } = yield call(generateGoogleAuthURL)
+ const {
+ uuid, auth_url: authUrl, expires_in: expiresIn,
+ } = yield call(generateGoogleAuthURL)
// Set the URL of the authentification browser window
authWindow.location = authUrl
- // Close the authWindow after 5 minutes
- // TODO: THIS VALUE SHOULD BE RETURNED FROM THE API
- setTimeout(() => {
- authWindow.close()
- }, 5 * 60 * 1000)
+ // Closing the authorisation window after the session expires
+ setTimeout(authWindow.close, expiresIn)
while (true) {
yield delay(HASH_CHECK_FREQUENCY)
diff --git a/src/redux/sagas/auth/workers/sso_link.ts b/src/redux/sagas/auth/workers/sso_link.ts
index 641148a7f..e7beba389 100644
--- a/src/redux/sagas/auth/workers/sso_link.ts
+++ b/src/redux/sagas/auth/workers/sso_link.ts
@@ -32,16 +32,15 @@ export default function* ssoLink({ payload: { callback, t } }: ISSOLink) {
}
try {
- const { uuid, auth_url: authUrl } = yield call(generateGoogleAuthURL)
+ const {
+ uuid, auth_url: authUrl, expires_in: expiresIn,
+ } = yield call(generateGoogleAuthURL)
// Set the URL of the authentification browser window
authWindow.location = authUrl
- // Close the authWindow after 5 minutes
- // TODO: THIS VALUE SHOULD BE RETURNED FROM THE API
- setTimeout(() => {
- authWindow.close()
- }, 5 * 60 * 1000)
+ // Closing the authorisation window after the session expires
+ setTimeout(authWindow.close, expiresIn)
while (true) {
yield delay(HASH_CHECK_FREQUENCY)