Browse Source

Merge pull request #6940 from nocodb/fix/6915-google-auth-bug

fix:  Google OAuth based token generation logic correction
pull/6955/head
Pranav C 1 year ago committed by GitHub
parent
commit
a8a069fd6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      packages/nc-gui/middleware/auth.global.ts

6
packages/nc-gui/middleware/auth.global.ts

@ -133,11 +133,13 @@ async function tryGoogleAuth(api: Api<any>, signIn: Actions['signIn']) {
authProvider = 'oidc'
}
// `extra` prop is used in our cloud implementation, so we are keeping it
const {
data: { token, extra },
} = await api.instance.post(`/auth/${authProvider}/genTokenByCode${window.location.search}`)
extraProps = extra
// if extra prop is null/undefined set it as an empty object as fallback
extraProps = extra || {}
signIn(token)
} catch (e: any) {
@ -148,7 +150,7 @@ async function tryGoogleAuth(api: Api<any>, signIn: Actions['signIn']) {
window.history.pushState(
'object',
document.title,
`${extraProps.continueAfterSignIn ? `${newURL}#/?continueAfterSignIn=${extraProps.continueAfterSignIn}` : newURL}`,
`${extraProps?.continueAfterSignIn ? `${newURL}#/?continueAfterSignIn=${extraProps.continueAfterSignIn}` : newURL}`,
)
window.location.reload()
}

Loading…
Cancel
Save