npm.io
1.0.10 • Published 5 years ago

numio-cdn

Licence
ISC
Version
1.0.10
Deps
4
Size
16 kB
Vulns
23
Weekly
0

NUMIO-CDN

A package for using numio service for authentication purpose. This package is used on front-end, you also need to install numio-sdk on your back-end to complete the process of authentication with numio.

Installation

To install using npm :

npm install numio-cdn

To install using Yarn :

yarn add numio-cdn

Getting Started

You have to get yourself registered on numio to start using it's authtication services. After registration you will get "APP_ID" and "APP_SECRET" which you will be using in your code to get started.

Example of Login With Numio

import React, {useState, useEffect} from "react;
import numio from "numio-cdn";
import SomeQrComponent from "some-qr-render" //example package for render QR

const MyComponent = () => {
    const [url,setUrl] = useState("");

    useEffect(()=>{
        getUrlFromNumio();
    },[])

    const getUrlFromNumio = async () => {
        try{
            const numioCDN = new numio({app_id: "APP_ID"}); //provide APP_ID you got after registration on numio.
            const res = await numioCDN.getUrlForLogin();
            setUrl(res);
            numioCDN.call(async(token) => {
                console.log(token); //you get token here which you will use to authenticate the user from numio-sdk package
            })
        }
        catch(e){
            console.log(e)
        }
    }

    return(
        <SomeQrComponent
        value={url}
        />
    )
}
Example of KYC With Numio
import React, {useState, useEffect} from "react;
import numio from "numio-cdn";
import SomeQrComponent from "some-qr-render" //example package for render QR

const MyComponent = () => {
    const [url,setUrl] = useState("");

    useEffect(()=>{
        getUrlFromNumio();
    },[])

    const getUrlFromNumio = async () => {
        try{
            const numioCDN = new numio({app_id: "APP_ID"}); //provide APP_ID you got after registration on numio.
            const res = await numioCDN.getUrlForKyc();
            setUrl(res);
        }
        catch(e){
            console.log(e)
        }
    }

    return(
        <SomeQrComponent
        value={url}
        />
    )
}