asq-react-native-facebook-log-in
v1.1.0
Published
react native bridge for facebook login sdk ported for ios
Downloads
20
Maintainers
Readme
React Native Facebook Log In
Minimalistic implementation of Facebook's log in SDK, Authenticates using public profile and email scopes. Log in returns token data required to authenticate user serverside.
Installation
Minimum Requirements
| react-native | iOS | | ------------ | :--: | | 0.50 | 10.3 |
NPM package
npm install asq-react-native-facebook-log-in
Getting started
- Follow Facebook's initial setup guide for ios
- Add
pod 'FBSDKCoreKit'
to your cocoapods file - Add
pod 'FBSDKLoginKit'
to your cocoapods file - Add
node-modules/asq-react-native-facebook-log-in/ios/ASQFacebookLogIn
to your libraries - Add
libASQFacebookLogIn.a
under Link Binary With Libraries in Build Phases - Add
$(SRCROOT)/../node_modules/asq-react-native-facebook-log-in/ios/ASQFacebookLogIn
to your Header Search Paths in Build Settings - At the top of
AppDelegate.m
file importASQFacebookLogin
library
#import "ASQFacebookLogIn.h"
- In
AppDelegate.m
filesdidFinishLaunchingWithOptions
function, configure the library
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Add ASQFacebookLogIn configuration
[ASQFacebookLogIn
application:application
didFinishLaunchingWithOptions:launchOptions];
}
- Add handling for Facebook's url schema
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<NSString *, id> *)options {
// Handle facebook's deep links
BOOL facebookLink = [ASQFacebookLogIn
application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
return facebookLink;
}
Usage
import FacebookLogIn from "asq-react-native-facebook-log-in";
logIn
const user = await FacebookLogIn.logIn();
// user = { accessToken: "", applicationID: "", userID: "" }
logOut
FacebookLogIn.logOut();