Skip to content

Commit

Permalink
ui: store the user crediential in localstorage
Browse files Browse the repository at this point in the history
We will want to share the user crediential across different tabs.
By default redux-oidc storge access_token in sessionStorge,
in this PR we will change it to localStorage.

Refs: #2078
  • Loading branch information
ChengYanJin committed Nov 29, 2019
1 parent 687b049 commit 37b1cc8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ui/src/ducks/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { call, put, takeEvery, select } from 'redux-saga/effects';
import { mergeTheme } from '@scality/core-ui/dist/utils';
import * as defaultTheme from '@scality/core-ui/dist/style/theme';
import { loadUser, createUserManager } from 'redux-oidc';
import { USER_FOUND } from 'redux-oidc';
import { WebStorageStateStore } from 'oidc-client';
import { store } from '../index';
import * as Api from '../services/api';
import * as ApiK8s from '../services/k8s/api';
import * as ApiSalt from '../services/salt/api';
Expand All @@ -23,6 +27,19 @@ const defaultState = {
language: EN_LANG,
theme: {},
api: null,
userManagerConfig: {
client_id: 'metalk8s-ui',
redirect_uri: 'http://localhost:3000/callback',
response_type: 'id_token',
scope:
'openid profile email offline_access audience:server:client_id:oidc-auth-client',
authority: '',
loadUserInfo: false,
post_logout_redirect_uri: '/',
userStore: new WebStorageStateStore({ store: localStorage }),
},
userManager: null,
isUserLoaded: false,
};

export default function reducer(state = defaultState, action = {}) {
Expand Down

0 comments on commit 37b1cc8

Please sign in to comment.