Skip to content

Commit

Permalink
fix(sso): unified credentials kvstore fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed May 3, 2022
1 parent 34b182a commit 97db6bb
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export default ({ api, coreSagas, networks }) => {

const signIn = function* () {
try {
debugger
const email = (yield select(selectors.core.settings.getEmail)).getOrFail('No email')
const guid = yield select(selectors.core.wallet.getGuid)
// TODO: in future only fetch unified credentials
Expand All @@ -231,6 +232,22 @@ export default ({ api, coreSagas, networks }) => {
selectors.core.kvStore.unifiedCredentials.getUnifiedOrLegacyNabuEntry
)).getOrElse({})

debugger

// sync legacy nabu credentials with unified kv entry
const unifiedNabuCredentials = (yield select(
selectors.core.kvStore.unifiedCredentials.getNabuCredentials
)).getOrElse({})
if (!unifiedNabuCredentials.nabuUserId || !unifiedNabuCredentials.nabuLifetimeToken) {
debugger
yield put(
actions.core.kvStore.unifiedCredentials.setUnifiedCredentials({
nabu_lifetime_token: nabuLifetimeToken,
nabu_user_id: nabuUserId
})
)
}

if (!nabuUserId || !nabuLifetimeToken) {
return yield put(
A.fetchUserDataSuccess({
Expand Down

0 comments on commit 97db6bb

Please sign in to comment.