INNER CODE UNIT · JavaScript
signInUsingOAuth
ujjavaldesai07/spring-boot-react-ecommerce-app · client/src/actions/index.js:80
export const signInUsingOAuth = googleAuth => async dispatch => {
log.info(`[signInUsingOAuth] googleAuth = ${googleAuth}`)
// check if not signed in
if (googleAuth && !googleAuth.isSignedIn.get()) {
log.info('[signInUsingOAuth] User has not signed in yet')
// sign in
googleAuth.signIn(JSON.parse(googleAuth.currentUser.get().getId())).then(async () => {
// if sign in works
if (googleAuth.isSignedIn.get()) {
log.info('[signInUsingOAuth] User is signed in successfully')
dispatch({
type: HANDLE_GOOGLE_AUTH_SIGN_IN,
payload: {
firstName: googleAuth.currentUser.get().getBasicProfile().getGivenName(),