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