Bài viết này sẽ hướng dẫn nhanh các bước cài đặt ứng dụng React Native đăng nhập bằng tài khoản Facebook.
Khởi tạo ứng dụng React Native.
npx react-native init ExampleApp
Need to install the following packages:
react-native
Ok to proceed? (y) y
Cài đặt thư viện https://github.com/thebergamo/react-native-fbsdk-next
Tạo ứng dụng trên Facebook
Truy cập https://developers.facebook.com/apps/ chọn Create App, điền các thông tin liên quan tới ứng dụng.
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.16.03-1024x897.png)
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.16.31-1024x530.png)
Sau khi điền xong thông tin chọn Create app.
Tại trang tổng quan chọn Facebook Login (Set up).
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.17.31-1024x640.png)
Đối với Android và iOS các bước sẽ gần giống nhau. Ở các bước kỹ thuật có thể nhấn Tiếp tục (Next).
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.17.45-1024x300.png)
Dành cho Android
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.18.41-1024x580.png)
Key Hashes https://developers.facebook.com/docs/android/getting-started/#samples
Tôi sẽ setup 2 key hash ở đây bao gồm Development Key và Release Key.
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.20.21-1024x529.png)
Dành cho iOS
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.23.33-1024x529.png)
Sau khi hoàn thành xong các bước cho Android và iOS và cần lấy những thông tin sau:
– App ID (hiển thị ngay trên đầu của ứng dụng)
– Client Token (Settings -> Advanced -> Client token)
![](http://tuantvk.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-22.25.24-1024x554.png)
Xem thêm thông tin sử dụng thư viện https://github.com/thebergamo/react-native-fbsdk-next