13.0.0-beta.0 • Published 10 months ago

@recursyve/nice-auth0-kit v13.0.0-beta.0

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

NiceAuth0Kit

Nice Auth0 kit is a wrapper of the OAuth2 and MFA api for Auth0. We support the password, refresh_token and mfa grant types.

Installation

npm install --save @recursyve/nice-auth0-kit

Usage example

All the magic is done with the NiceAuthenticationService.

Password Grant

import { lastValueFrom } from "rxjs";

@Injectable()
export class LoginService {
    constructor(private auth: NiceAuthenticationService) {
    }

    public async login(): Promise<void> {
        const res = await lastValueFrom(
            this.auth.passwordGrant("username", "password")
        );
    }
}

Response

{
    "success": bool,
    "mfaRequired": bool
}

NoAuthenticatorException

The NoAuthenticatorException is thrown when an MFA is required and the user doesn't have an authenticator setup

Validate OOB code

import { lastValueFrom } from "rxjs";

@Injectable()
export class LoginService {
    constructor(private auth: NiceAuthenticationService) {
    }

    public async validateCode(): Promise<void> {
        const res = await lastValueFrom(
            this.auth.validateOobCode("123456")
        );
    }
}

Add MFA Authenticator

import { lastValueFrom } from "rxjs";

@Injectable()
export class LoginService {
    constructor(private auth: NiceAuthenticationService) {
    }

    public async addAuthenticator(): Promise<void> {
        const res = await lastValueFrom(
            this.auth.addMfaAuthenticator({
                type: "sms",
                phoneNumber: "1111111111"
            })
        );
    }
}
16.0.0-beta.20

10 months ago

17.0.0-beta.20

1 year ago

16.0.0-beta.19

2 years ago

14.0.0-beta.17

2 years ago

15.0.0-beta.18

2 years ago

13.0.0-beta.16

3 years ago

13.0.0-beta.15

3 years ago

13.0.0-beta.13

3 years ago

13.0.0-beta.12

3 years ago

13.0.0-beta.14

3 years ago

13.0.0-beta.11

3 years ago

13.0.0-beta.10

3 years ago

13.0.0-beta.8

3 years ago

13.0.0-beta.7

3 years ago

13.0.0-beta.9

3 years ago

13.0.0-beta.6

3 years ago

13.0.0-beta.5

3 years ago

13.0.0-beta.4

3 years ago

13.0.0-beta.3

3 years ago

13.0.0-beta.2

3 years ago

13.0.0-beta.1

3 years ago

13.0.0-beta.0

3 years ago