https://github.com/azuriom/azauthjs
A JavaScript implementation of the Azuriom Auth API.
https://github.com/azuriom/azauthjs
Last synced: about 1 year ago
JSON representation
A JavaScript implementation of the Azuriom Auth API.
- Host: GitHub
- URL: https://github.com/azuriom/azauthjs
- Owner: Azuriom
- License: mit
- Created: 2020-08-27T17:57:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T20:49:10.000Z (about 2 years ago)
- Last Synced: 2024-10-14T08:18:41.229Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://azuriom.com/docs/api-auth
- Size: 110 KB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AzAuth JS
[](https://github.com/Azuriom/AzAuthJS/actions/workflows/tests.yml)
[](https://www.npmjs.org/package/azuriom-auth)
[](https://azuriom.com/discord)
A JavaScript implementation made in [TypeScript](https://www.typescriptlang.org/) of the [Azuriom Auth API](https://azuriom.com/docs/api-auth).
## Installation
```
npm install azuriom-auth
```
## Usage
```js
import { AuthClient } from 'azuriom-auth'
async function login(email, password) {
const client = new AuthClient('')
let result = await client.login(email, password)
if (result.status === 'pending' && result.requires2fa) {
const twoFactorCode = '' // IMPORTANT: Replace with the 2FA user temporary code
result = await client.login(email, password, twoFactorCode)
}
if (result.status !== 'success') {
throw 'Unexpected result: ' + JSON.stringify(result)
}
return result
}
```