MSalmanTariq / react-google-one-tap-login

React wrapper for google one tap login
Other
31 stars 16 forks source link

Display for the first time, do not display after refreshing the page #21

Open mzrybbd opened 1 year ago

mzrybbd commented 1 year ago

The page contains both Sign in With Google button and One Tap, and One Tap will be displayed the first time, but the refreshed page will not be displayed. When opened with a new tab, it will be displayed again.

The code is as follows

import GoogleOneTapLogin from 'react-google-one-tap-login'; <GoogleOneTapLogin onError={(error) => console.error(error, 'errorGoogle2.0')} onSuccess={(response) => console.info(response, 'successGoogle2.0')} googleAccountConfigs={{ client_id: CLIENT_ID, callback, cancel_on_tap_outside: false, context: comeFrom === 'login' ? 'signin' : 'signup', }} />

ghcpuman902 commented 1 year ago

hi, that is normal behaviour. According to Google's doc, they won't keep track of whether user is logged in for you, they will only provide prompt to user and pass you the user info when user click on the prompt to login.

the developer should implement cookies or session to keep track of whether a user is logged in and decide whether to show this component. It might be helpful to look at my pull request that includes a next.js example.