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

LoginSocialLinkedIn signs in successfully but onResolve function is not called so I cannot get data and popup does not close automayically #166

Closed MeryAmun closed 7 months ago

MeryAmun commented 7 months ago

When I click the , new windoe pops up with sign in form, after filling in the right credentials ,I get the authrization request and am redirected after clicking authorize. Only that popup does not close automatically when i click cancel or authorize like here https://react-social-login.netlify.app/, and onResolve function is not called.Infact only onLoginStart is called and "started" is logged to the console.thanks. Here is my code

<LoginSocialLinkedin isOnlyGetToken client_id={process.env.REACT_APP_LINKEDIN_APP_ID} client_secret={process.env.REACT_APP_LINKEDIN_APP_SECRET} redirect_uri={${window.location.origin}} onLoginStart={() => console.log("Started")} onLogoutSuccess={() => console.log("Successful")} scope="profile email" onResolve={({ provider, data }) => { console.log(provider); console.log(data); console.log("testing");

                      }}
                      onReject={(err) => {
                        console.log(err);
                      }}
                      className="d-flex justify-content-center mt-1 mb-1">
                      <LinkedInLoginButton/>
                    </LoginSocialLinkedin>
cuongdevjs commented 7 months ago

please use redirect_uri by window.location.href instead.

MeryAmun commented 7 months ago

@cuongdevjs Thank you sir but it still did not work

cuongdevjs commented 7 months ago

is Login put on a separate page or just a component?

MeryAmun commented 7 months ago

its in the same page with the other reactjs-social-logins... just like the demo

cuongdevjs commented 7 months ago

it should be put on a separate page. For example: YOUR_DOMAIN/login, if it is only a small component in a popup / modal / dialog, it won't work.

MeryAmun commented 7 months ago

It workss when I move the login coode into the /login page...i think the problem was that iy it nested too deep in the code

MeryAmun commented 7 months ago

It workss when I move the login coode into the /login page...i think the problem was that iy it nested too deep in the code thank you sir @cuongdevjs .But I need to be clear if that was the reason