'How to verify facebook login access token from Node js
I want to implement facebook login my React native app. I am using react-native-fbsdk-next in React native for getting access token.
I want to authorize it from our Backend to register it in our DB. I tried but couldn't find any way to implement it. I saw passport-facebook also but didn't get how to use it with react native.
I just want that I will send token that I get from fb login to backend(Node js) and it will verify it. This approach worked for me in google sign in but I am unable to find anything for Facebook login.
Any kind of help will be appreciated. Thank you
Solution 1:[1]
just check the token you received from the app login by running it with axios or fetch on the follwing url
Below is a sample axios function (middleware)
exports.checkFacebookToken = async (accessToken) => {
try {
const check = await axios.get(
`https://graph.facebook.com/me?access_token=${accessToken}`
);
console.log(check);
return true;
} catch (error) {
console.log(error.response.data.error.message);
return false;
}
};
More details on other social networks on this answer iOS & node.js: how to verify passed access token?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mohamed Daher |
