Git Product home page Git Product logo

onlyauth-javascript's Introduction

OnlyAuth Javascript Library

Sign up for OnlyAuth 2FA API

Sign up for the OnlyAuth 2FA API to get your API credentials.

Installation Guide

Check out the OnlyAuth 2FA API Implementation guide for full details.

SDK Installation

npm

Install it via:

npm install onlyauth --save

Finally, you need to build the module:

npm run build

git

Install it via:

    npm install onlyauth-io/onlyauth-javascript

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

import onlyauth from 'onlyauth';
let defaultClient = onlyauth.ApiClient.instance;
// Configure Bearer (API Secret) access token for authorization: BearerAuth
let BearerAuth = defaultClient.authentications['BearerAuth'];
BearerAuth.accessToken = "API SECRET"

let apiInstance = new onlyauth.AuthenticationApi();
let appId = "appId_example"; // String | Uuid of the OnlyAuth App (APPX-XXX)
let clientId = "clientId_example"; // String | Uuid of you in the OnlyAuth Platform (CLNT-XXX)
let endUserPhoneNumber = "endUserPhoneNumber_example"; // String | Phone number of the end user (E164 format)
let endUserUuid = "endUserUuid_example"; // String | Uuid of the end user (any type)
let redirectUri = "redirectUri_example"; // String | URL to redirect to after authentication
let language = "language_example"; // String | Language code (e.g., en-US)
let region = "region_example"; // String | Region code (us-1)
apiInstance.createAccessToken(appId, clientId, endUserPhoneNumber, endUserUuid, redirectUri, language, region).then((data) => {
  console.log('API called successfully. Token: ' + data.token);
}, (error) => {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://api.onlyauth.io

Class Method HTTP request Description
OnlyAuth.AppsApi deleteApp DELETE /apps/{app_id} Delete an app
OnlyAuth.AppsApi getAppById GET /apps/{app_id} Get an app by uuid
OnlyAuth.AppsApi getApps GET /apps Get all apps
OnlyAuth.AppsApi newApp POST /apps Create a new app
OnlyAuth.AppsApi updateApp POST /apps/{app_id} Update an app
OnlyAuth.AuthenticationApi createAccessToken POST /server/access-tokens/new Creates a short-lived JWT token to integrate the widget
OnlyAuth.AuthenticationApi validateSuccessToken GET /server/success-tokens Validates a success token after user completes authentication

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

BearerAuth

  • Type: Bearer authentication (API Secret)

onlyauth-javascript's People

Contributors

onlyauth-dev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.