Skip to main content

intro

OA Auth Client​

The OA Authentication Helper Library. The OA Auth helper library lets you write javascript code to make HTTP requests to the OA-Auth API. This library is intended for front-end, client-side applications using React, React Native, or plain HTML/CSS/Javascript.

Visit Docs for more info.

Install

This package is published on Github's Package Registry

  1. Login to Github Package registry
npm login --registry=https://npm.pkg.github.com --scope=@obsidian-achernar
  1. Add this to .yarnrc for yarn or .npmrc for npm
"@Obsidian-Achernar:registry" "https://npm.pkg.github.com"

With npm:

npm install @obsidian-achernar/oa-auth-client

or with yarn:

yarn add @obsidian-achernar/oa-auth-client

Usage​

const url = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // Your OA auth URL

import Auth from 'oa-auth';
const client = Auth(url);

(async () => {
const { data, error } = await client.getCountries();
console.log('data', data);
console.log('error', error);
})();
Tip

It's okay to hardcode your url when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out How to Set Environment Variables in React Native for more information.