Reputation: 37
I'm implementing login with facebook and LinkedIn using React.js. getting below error's unable to resolve this. used below packages react-facebook-login and react-linkedin-login-oauth2
import React from 'react';
import { useLinkedIn } from "react-linkedin-login-oauth2";
import linkedin from "react-linkedin-login-oauth2/assets/linkedin.png";
import FacebookLogin from 'react-facebook-login/dist/facebook-login-render-props';
const FaceBookLoginProvider = () => {
const responseFacebook = (response) => {
console.log(response);
};
return (
<FacebookLogin
appId="498310359268039"
autoLoad={true}
fields="name,email,picture"
callback={responseFacebook}
/>
);
}
function LinkedInLoginProvider() {
const { linkedInLogin } = useLinkedIn({
clientId: '86wj5ppsvt1dzo',
redirectUri: 'http://localhost:3000/linkedin',
onSuccess: (code) => {
console.log(code);
},
onError: (error) => {
console.log(error);
},
});
return (
<>
<img
src={linkedin}
alt="Log in with Linked In"
style={{ maxWidth: '180px' }}
onClick={linkedInLogin}
/>
</>
);
}
export { FaceBookLoginProvider, LinkedInLoginProvider }
Imported in the App.js file:
function App() {
return (
<>
<FaceBookLoginProvider />
<LinkedInLoginProvider />
</>
);
}
export default App;
I'm using below react version, and package related details:
react version is ^18.2.0. react-facebook-login: "^4.1.1", react-linkedin-login-oauth2: "^2.0.1".
While clicking on the facebook button, getting below errors:
in .env file given HTTPS=true.
Below facebook error is coming on page load also, even without clicking on facebook button.
in console we are getting bellow error:
For, linkedIn getting below error in the pop-up:
Below are the steps followed to create app and appid:
Below are the steps followed to create app and clientid in linkedIn:
Upvotes: 0
Views: 84