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]);

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Just Importing Code From The Internet

🚔 RCH Airdrop

Things I Have Learned While Using Google Firebase Part III

Asynchronous JavaScript: An Introduction to JavaScript Promises

Custom events in JavaScript

Rethinking the Front-end: Micro Frontend

Create a Video Chat Application with Laravel 7 & Vue.js(based on WebRTC)

How to handle javascript promise rejection in case of async-await

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

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

More from Medium

A Robinhood Clone with React Native | Chapter 1: The Navigation

Fetching Data from Firestore and save it inside the Context

Testing React Context Providers using React Native Testing Library

React Native — How to handle data migration with WatermelonDB