fix: allow auth token to persist if the browser is closed #2545

Merged
neb-b merged 1 commit from returning-users into master 2019-06-13 18:10:50 +02:00

View file

@ -29,7 +29,7 @@ import { formatLbryUriForWeb } from 'util/uri';
import 'scss/all.scss'; import 'scss/all.scss';
const APPPAGEURL = 'lbry://?'; const APPPAGEURL = 'lbry://?';
const COOKIE_EXPIRE_TIME = 60 * 60 * 24 * 365; // 1 year
// @if TARGET='app' // @if TARGET='app'
const { autoUpdater } = remote.require('electron-updater'); const { autoUpdater } = remote.require('electron-updater');
autoUpdater.logger = remote.require('electron-log'); autoUpdater.logger = remote.require('electron-log');
@ -73,8 +73,11 @@ Lbryio.setOverride(
const newAuthToken = response.auth_token; const newAuthToken = response.auth_token;
authToken = newAuthToken; authToken = newAuthToken;
// @if TARGET='web' // @if TARGET='web'
document.cookie = cookie.serialize('auth_token', authToken); document.cookie = cookie.serialize('auth_token', authToken, {
maxAge: COOKIE_EXPIRE_TIME,
});
// @endif // @endif
// @if TARGET='app' // @if TARGET='app'
ipcRenderer.send('set-auth-token', authToken); ipcRenderer.send('set-auth-token', authToken);