From 366b502aff252316b62642948041f8ac6fd9573e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 13 Jun 2019 11:22:43 -0400 Subject: [PATCH] fix: allow auth token to persist if the browser is closed --- src/ui/index.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/index.jsx b/src/ui/index.jsx index deeb9fa24..a7a430bb9 100644 --- a/src/ui/index.jsx +++ b/src/ui/index.jsx @@ -29,7 +29,7 @@ import { formatLbryUriForWeb } from 'util/uri'; import 'scss/all.scss'; const APPPAGEURL = 'lbry://?'; - +const COOKIE_EXPIRE_TIME = 60 * 60 * 24 * 365; // 1 year // @if TARGET='app' const { autoUpdater } = remote.require('electron-updater'); autoUpdater.logger = remote.require('electron-log'); @@ -73,8 +73,11 @@ Lbryio.setOverride( const newAuthToken = response.auth_token; authToken = newAuthToken; + // @if TARGET='web' - document.cookie = cookie.serialize('auth_token', authToken); + document.cookie = cookie.serialize('auth_token', authToken, { + maxAge: COOKIE_EXPIRE_TIME, + }); // @endif // @if TARGET='app' ipcRenderer.send('set-auth-token', authToken);