app uses auth token header #2528

Merged
jessopb merged 1 commit from authHeaders into master 2019-06-06 22:39:20 +02:00
2 changed files with 6 additions and 1 deletions

View file

@ -119,7 +119,7 @@
"jsmediatags": "^3.8.1", "jsmediatags": "^3.8.1",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#02f6918238110726c0b3b4248c61a84ac0b969e3", "lbry-redux": "lbryio/lbry-redux#ed94218cdb3409b963aec136ffe3c11c9e3bc875",
"lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845", "lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",

View file

@ -89,6 +89,7 @@ Lbryio.setOverride(
() => () =>
new Promise(resolve => { new Promise(resolve => {
if (authToken) { if (authToken) {
Lbry.setApiHeader('X-Lbry-Auth-Token', authToken);
resolve(authToken); resolve(authToken);
} else { } else {
// @if TARGET='app' // @if TARGET='app'
@ -101,6 +102,10 @@ Lbryio.setOverride(
// @endif // @endif
// @if TARGET='web' // @if TARGET='web'
const { auth_token: authToken } = cookie.parse(document.cookie); const { auth_token: authToken } = cookie.parse(document.cookie);
if (authToken) {
Lbry.setApiHeader('X-Lbry-Auth-Token', authToken);
}
resolve(authToken); resolve(authToken);
// @endif // @endif
} }