Check out the Auth with Facebook docs.
Try it at https://expo.io/@community/with-facebook-auth
- Run
yarn
ornpm install
- Run
expo start
, try it out. - Press "Open FB Auth" in the app and then check your logs. Take the
redirectUrl
that was logged and enter it into the "Valid OAuth redirect URIs" in your Facebook app configuration step below.
- Follow the steps described in the Facebook for Developers documentation
- Add the "Facebook Login" product and configure it (screenshot)
- Make the app public (screenshot)
- Swap out the
FB_APP_ID
inApp.js
with your Facebook app's id.
Expo provides a
WebBrowser
API that opens a SFSafariViewController or Chrome Custom Tab in a modal
window. This provides a much better user experience than using a
WebView, and it's more secure for your users because code cannot be
injected into these browser windows. Additionally, they share cookies
with the system browser, so there is no need to re-enter credentials if
already authenticated. Expo also provides a wrapper around the WebBrowser
API which is called AuthSession,
which makes setting up an authentication flow using WebBrowser
dead simple.
This example demonstrates how to use the AuthSession
API to sign in to
Facebook.