React

Requirements – Node, npm.

Steps

  1. Install the sawo package

npm i sawo

2. Import the Sawo class from the sawo package

import Sawo from "sawo"

3. Login to sawo dev console

4. Create new project

  • Set project name

  • Set project host

    • For dev: point to localhost

    • For prod: point to your domain

  • Copy the API key

5 . On your source, create a container for sawo component inside body tag.

<div id="sawo-container" style="height: 300px; width: 300px;"></div>

6. Configurations

var config = {
// should be same as the id of the container created on 3rd step
containerID: "<container-ID>",
// can be one of 'email' or 'phone_number_sms'
identifierType: "phone_number_sms",
// Add the API key copied from 2nd step
apiKey: "",
// Add a callback here to handle the payload sent by sdk
onSuccess: (payload) => {},
};

7. Create Sawo instance

let sawo = new Sawo(<configuration>)

8. Call the showForm method "showForm" method is responsible to render the form in the given container.

sawo.showForm()

9. After successful setup of Sawo sdk, a login form will rendered in the provided container.

You are all set to use SAWO in your application