Keycloak sso #7203
4 changed files with 25 additions and 20 deletions
|
@ -157,7 +157,7 @@
|
||||||
"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#32b578707116d45f5b51b7ab523d200e75668676",
|
"lbry-redux": "lbryio/lbry-redux#32b578707116d45f5b51b7ab523d200e75668676",
|
||||||
"lbryinc": "lbryio/lbryinc#f133a7ed62c1f2202f98e785e923a7d841504d0d",
|
"lbryinc": "lbryio/lbryinc#6714d125602da6d383d8d8d9d6ebffb30b46869b",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
"lodash-es": "^4.17.14",
|
"lodash-es": "^4.17.14",
|
||||||
|
|
30
ui/index.jsx
30
ui/index.jsx
|
@ -259,22 +259,25 @@ function AppWrapper() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
function initKeycloak() {
|
function initKeycloak() {
|
||||||
console.dir(keycloak)
|
console.dir(keycloak);
|
||||||
keycloak.init(
|
keycloak
|
||||||
{ onLoad: 'check-sso',
|
.init({
|
||||||
|
onLoad: 'check-sso',
|
||||||
silentCheckSsoFallback: false,
|
silentCheckSsoFallback: false,
|
||||||
didInit: true,
|
silentCheckSsoRedirectUri: window.location.origin + '/silent-check-sso.html',
|
||||||
redirectUri: isDev ? 'http://localhost:9090/' : `${SITE_URL}/`}
|
redirectUri: isDev ? 'http://localhost:9090/' : `${SITE_URL}/`,
|
||||||
).then(function(authenticated) {
|
})
|
||||||
setKeycloakReady(true);
|
.then(function (authenticated) {
|
||||||
console.log('INIT: ', authenticated ? 'Authenticated' : 'Not Authenticated');
|
setKeycloakReady(true);
|
||||||
}).catch(function() {
|
console.log('INIT: ', authenticated ? 'Authenticated' : 'Not Authenticated');
|
||||||
console.log('INIT: FAILED');
|
})
|
||||||
});
|
.catch(function () {
|
||||||
|
console.log('INIT: FAILED');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('KCR RENDER', keycloakReady)
|
console.log('KCR RENDER', keycloakReady);
|
||||||
if (!keycloakReady) {
|
if (!keycloakReady) {
|
||||||
initKeycloak();
|
initKeycloak();
|
||||||
}
|
}
|
||||||
|
@ -294,7 +297,8 @@ function AppWrapper() {
|
||||||
* and we have checked with keycloak for a token
|
* and we have checked with keycloak for a token
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (readyToLaunch && persistDone && keycloakReady) { // keycloak ready
|
if (readyToLaunch && persistDone && keycloakReady) {
|
||||||
|
// keycloak ready
|
||||||
if (DEFAULT_LANGUAGE) {
|
if (DEFAULT_LANGUAGE) {
|
||||||
app.store.dispatch(doFetchLanguage(DEFAULT_LANGUAGE));
|
app.store.dispatch(doFetchLanguage(DEFAULT_LANGUAGE));
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,10 +193,11 @@ const populateAuthTokenHeader = () => {
|
||||||
if (action.data) {
|
if (action.data) {
|
||||||
}
|
}
|
||||||
const tokens = getTokens();
|
const tokens = getTokens();
|
||||||
// if (tokens.access_token) {
|
if (tokens.access_token) {
|
||||||
// Lbry.setApiHeader('Authorization', 'Bearer ' + tokens.access_token);
|
Lbry.setApiHeader('Authorization', 'Bearer ' + tokens.access_token);
|
||||||
// }
|
} else {
|
||||||
Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, tokens.auth_token);
|
Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, tokens.auth_token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return next(action);
|
return next(action);
|
||||||
|
|
|
@ -10163,9 +10163,9 @@ lbry-redux@lbryio/lbry-redux#32b578707116d45f5b51b7ab523d200e75668676:
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
uuid "^8.3.1"
|
uuid "^8.3.1"
|
||||||
|
|
||||||
lbryinc@lbryio/lbryinc#f133a7ed62c1f2202f98e785e923a7d841504d0d:
|
lbryinc@lbryio/lbryinc#6714d125602da6d383d8d8d9d6ebffb30b46869b:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/f133a7ed62c1f2202f98e785e923a7d841504d0d"
|
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/6714d125602da6d383d8d8d9d6ebffb30b46869b"
|
||||||
dependencies:
|
dependencies:
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue