Closed sufian1999 closed 2 weeks ago
I fixed my problem by removing permissions at the time of logout.
`const FbLogout = async (loaderValue: boolean) => {
setloading(loaderValue == false ? false : true)
setloading2(loaderValue == false ? true : false)
// LoginManager.logOut()
AccessToken.getCurrentAccessToken().then(async data => {
console.log('device token data>>>>>',data);
const accessToken: any = data?.accessToken.toString();
await RemovePermissionsAndLogout(accessToken)
})
}`
`const RemovePermissionsAndLogout = (accessToken: string) => {
let logout =
new GraphRequest(
"me/permissions/",
{
accessToken: accessToken,
httpMethod: 'DELETE'
},
async (error, result) => {
if (error)
{
console.error('You didn\'t integrate from this device. Please disconnect your integration from the previous device: ' + error);
LogoutAndRemoveInt()
}
else
{
LogoutAndRemoveInt()
}
});
new GraphRequestManager().addRequest(logout).start();
};`
`const LogoutAndRemoveInt = async () => {
LoginManager.logOut();
const user: any = await AsyncStorage.getItem("user")
const newuser = JSON.parse(user)
await axios.get(`${api.disconnectIntegration}AgentID=${newuser?.id}`)
.then(res => {
console.log('response=================>', res.data)
setloading(false)
setloading2(false)
props.navigation.navigate(routes.MainIntegration)
})
.catch(err => {
console.log(err)
setloading(false)
setloading2(false)
})
}`
This is my FB logout function. This function does not give any error but after executing this function when I go to Business Integrations in my FB account, my app is still there. I want to remove it from there as well.
import { AccessToken, GraphRequest, GraphRequestManager, LoginManager, } from 'react-native-fbsdk-next';
const FbLogout = async (loaderValue: boolean) => {
]