react-native-auth-module
Version:
An Authentication Module using react-native-api-client-wrapper
105 lines (83 loc) • 2.74 kB
Markdown
using react-native-api-client-wrapper
```sh
$ npm install --save react-native-api-client-wrapper
```
```sh
$ npm install --save react-native-auth-module
```
the AuthManager has 3 parameters.
1.) facebook_secretkey generated from facebook dev for Facebook Login
2.) GoogleAndroidClientID generated from google API for social auth google email Login
3.) GoogleIOSClientID generated from google API for social auth google email Login
```js
import {AuthManager} from 'react-native-auth-module'
import {Constants} from 'your-constants'
let authManager;
componentWillMount() {
/**
* Initialize the AuthManager
* preferably during will mount method
**/
this.authManager = new AuthManager(
Constants.Facebook.SECRET_KEY,
Constants.Gmail.ANDROID.CLIENT_ID,
Constants.Gmail.IOS.CLIENT_ID
)
}
this.authManager.expoFacebookLogin(Constants.Facebook.API_ENDPOINT)
.then((response) => {
}).catch((error) => {
})
```
```js
expoFacebookLogin(APIEndpoint) {
/**
* accepts an APIEndpoint param of your APIServer
* returns a Token that will send to the APIEndpoint
**/
}
expoGoogleLogin(APIEndpoint) {
/**
* accepts an APIEndpoint param of your API Server
* returns a token that will send to the APIEndpoint
**/
}
credentialsLogin(loginUrl, username, password) {
/**
* default login usage
* loginUrl = Login APIEndpoint of your API Server
* username, password
* returns a Token which you can access by .then((resposne) => {response.key})
**/
}
changePassword(Token, url, old_password, new_password, confirm_password) {
/**
* accepts a Token from your Account, can be null depends on your API Server
* url = APIendpoint for your changepassword
**/
}
resetPassword(resetPasswordUrl, email) {
/**
* resetPasswordUrl param = APIEndpoint of your reset password
* email = email used in your account to send the details of your new password
**/
}
signUp(signUpUrl, params = {}) {
/**
* signUpUrl = APIEndpoint where you send the params object
* params = object type parameter that will send the details of your registration
* ex: {
* username: username,
* password; password,
* email: email
* }
**/
}
```
ISC © [Redmond Job V. Perez](https://bitbucket.org/redmond-ingenuity/)
> An Authentication Module