# react-native-sawo

> Passwordless and OTP-less Authentication for your website. It helps you to authenticate user via their email or phone number.

Latest version **1.0.5** (published 2021-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-sawo
pnpm add react-native-sawo
yarn add react-native-sawo
bun add react-native-sawo
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-05-03 |
| First published | 2021-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Chander Vyas |
| Maintainers | sawolabs |
| Keywords | Sawo, otp, login, Passwordless, OTP-less, Authentication |

## Links

- npm: https://www.npmjs.com/package/react-native-sawo
- Repository: https://github.com/sawolab/react-native-sdk
- Homepage: https://github.com/sawolab/react-native-sdk#readme
- Issues: https://github.com/sawolab/react-native-sdk/issues
- npm.io page: https://npm.io/package/react-native-sawo

## Dependencies (1)

- [react-native-webview](https://npm.io/package/react-native-webview.md) ^11.3.2

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2021-05-03
- 1.0.4 — 2021-04-11
- 1.0.3 — 2021-04-11
- 1.0.2 — 2021-04-11
- 1.0.1 — 2021-04-11
- 1.0.0 — 2021-04-11

## README

# Sawo React-Native SDK

[![Current version](https://img.shields.io/badge/npm%20package-1.0.0-blue)](https://www.npmjs.com/package/sawo)
[![Supported React Native Version](https://img.shields.io/static/v1?logo=react&label=react-native&message=0.64.0&color=777bb4)](https://www.npmjs.com/package/react-native)

## Demo 

|Login Button      | Email Login     | Phone Login     | User Data     |
|------------|------------|------------|------------|
| <img src="https://raw.githubusercontent.com/sawolab/react-native-example/05713ca4c7f1b876144a7f2b030170c40d5771c6/public/images/1.jpeg" width="150"> | <img src="https://raw.githubusercontent.com/sawolab/react-native-example/05713ca4c7f1b876144a7f2b030170c40d5771c6/public/images/2.jpeg" width="150"> | <img src="https://raw.githubusercontent.com/sawolab/react-native-example/05713ca4c7f1b876144a7f2b030170c40d5771c6/public/images/3.jpeg" width="150"> | <img src="https://raw.githubusercontent.com/sawolab/react-native-example/05713ca4c7f1b876144a7f2b030170c40d5771c6/public/images/4.jpeg" width="150"> |


## Table of Contents

- [Overview](#overview)
- [Peer Dependencies](#PeerDependencies)
- [Installation](#installation)
- [License](#license)

## Overview

[Sawo](https://sawolabs.com/) provides the api and infrastructure you need to authenticate your users in react-native project.

For more information, visit the [Sawo SDK documentation](https://docs.sawolabs.com/sawo/).

## PeerDependencies
Sawo have peer dependecies on 
- react
- react-native
- react-navigation
- react-native-webview



## Installation

Peer Dependecy check
- Check if "React Navigation" is properly installed, if not please follow [React navigation installation doc](https://reactnavigation.org/docs/getting-started)

- Check for 'react-native-webiew', it is required package for Sawo. As currently auto linking for package depencdy is not there in react-native. 

    ``` JavaScript
    npm i react-native-webview
    ```

Generate API_KEY and SECRET_KEY
- Login to sawo [dev console.](https://dev.sawolabs.com/)
- Create a new project
    - Set Project Name
    - Set Project Host
        -  For dev: point to localhost
        -  For prod: point to your domain.
-  Copy your API key & Secret Key


To get started with Sawo, use the npm to add the package to your project's dependencies:

``` Shell
$ npm install react-native-sawo
```

## Configuration

import Sawo package in your project
``` JavaScript
import Sawo from 'react-native-sawo';
```

Configure your route
``` JavaScript
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';

const Stack = createStackNavigator();

<NavigationContainer>
    <Stack.Navigator>
        <Stack.Screen
          name="YOUR_LOGIN_ROUTE"
          component={Sawo}
          options={{
            title: 'OTP Login',
            headerShown: false, // by default its true, to hide the header
          }}
        />
    </Stack.Navigator>
</NavigationContainer>
```

then when calling route, we need to pass required credentials and a callback method to receive the user login data
``` JavaScript
navigation.navigate('YOUR_LOGIN_ROUTE', {
    apiKey: 'YOUR_API_KEY',
    secretKey: 'YOUR_SECRET_KEY',
    identifierType: '', // email | phone_number_sms,
    callback: data => {}
});
```
## [Click here to visit example project](https://github.com/sawolab/react-native-example)


## License

Sawo SDK is licensed under the [MIT License](LICENSE).

---
_Source: https://npm.io/package/react-native-sawo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
