cuongdevjs / reactjs-social-login

Group Hook ReactJS components for login social network
https://react-social-login.netlify.app
MIT License
168 stars 75 forks source link

Can't get the user's email on LoginSocialGoogle #140

Closed Mudassar-dev closed 11 months ago

Mudassar-dev commented 11 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

cuongdevjs commented 11 months ago

please give me your code. I've tried on the site demo and it still works

Mudassar-dev commented 10 months ago

@cuongdevjs please look into it

Screenshot 2023-11-06 145352

cuongdevjs commented 10 months ago

please give me your code

cuongdevjs commented 10 months ago

or re-check the account's permission

Mudassar-dev commented 10 months ago
Code:
  <LoginSocialGoogle
                    client_id={process.env.REACT_APP_GOOGLE_CLIENT_ID || ""}
                    cookiePolicy={"single_host_origin"}
                    fields="name,email"
                    onResolve={GoogleAuth}

                    onReject={err => {
                        console.log(err);
                    }}
                >
                    <li><a><img src={SOCIAL_ICON.Login_Icon.google} /></a></li>
                </LoginSocialGoogle>
cuongdevjs commented 10 months ago

have you tried to remove cookiePolicy and fields prop?

quanndh commented 9 months ago
image

Why im getting this instead of user information? @cuongdevjs

Mudassar-dev commented 9 months ago

@quan

image Why im getting this instead of user information? @cuongdevjs

Hi try this. it's work for me

<LoginSocialGoogle
                    client_id={process.env.REACT_APP_GOOGLE_CLIENT_ID || ""}
                    typeResponse="idToken"
                    scope="openid profile email"
                    ux_mode="popup"

                    onResolve={({ provider, data }) => {
                        GoogleAuth({ provider, data });
                    }}

                    onReject={err => {
                        console.log(err);
                    }}
                />