README
React Native Auth Lib
This library implements authentication with Google, Facebook, Biometrics and simple check with email and password.
Dependencies
Next dependencies are requeried on own package app for Google Sign-in and Biometrics.
$ npm install @react-native-community/google-signin --save
$ npm install react-native-biometrics --save
Build
Follow the next steps for build and publish
$ npm install
$ npm run build
Folder lib/ must be generate.
Install
Using npm on your ReactNative project
$ npm install react-native-auth-lib --save
Usage
<RNAuthComponent
style={{ marginTop: 10 }}
signInType={SignInType.GOOGLE}
permissions={[]}
http={{
url: "https://api.beta.lamenteesmaravillosa.com/v2/",
headers: {
"Authorization": "Mejor eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1ZDUyZDhhZDdhMjNkYjBiNzgzZWI4MWUiLCJpYXQiOjE1OTUyNjA0MTMsImV4cCI6NDcxOTMxMTYxM30.guJOaq1ysTQ1z423cCl_DtbL4oZWtqqS68nWwVsWqqU",
"Content-Type": "application/json",
"X-MC-KEY": "courses",
"X-MC-ALIAS": "lmem",
"X-APP-VERSION": "release",
"X-MC-PLATFORM": "courses",
"X-MC-ENV": "react-native"
}
}}
onSignIn={data => { console.log(data); this.setState(data); }}
onError={error => { console.log(error); this.setState(error); }}
/>
signInType: Type authentication. Enum with values: GOOGLE, FACEBOOK, BIOMETRIC or EMAIL.
permissions: Array with permissions used on Facebook list.
http: Object with API configuration requests on successs authentication.
onSignIn: Callback for success authentication. Return token for Google and Facebook.
onError: Callback for error authentication.