React native facebook auth

const handleFacebookClick = useCallback(async () => {
setIsLoading(true);
try {
await Facebook.initializeAsync({
appId: FACEBOOK_APP_ID,
});
const result = await Facebook.logInWithReadPermissionsAsync({
permissions: ['public_profile'],
});
if (result.type === 'success') {
const authData: IAuthData = {
externalId: result.userId,
identityToken: result.token,
};
processJoin(EXTERNAL_TYPE.FACEBOOK, authData);
} else {
setIsLoading(false);
}
} catch ({ message }) {
setIsLoading(false);
}
}, [processJoin]);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Viacheslav Volkov

Viacheslav Volkov

1 Follower

JS Developer from London, UK. Working with React, React Native and Typescript. My russian blog https://vexell.ru