13.0.0-beta.0 • Published 11 months ago
@recursyve/nice-auth0-kit v13.0.0-beta.0
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-kitUsage 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.22
11 months ago
18.0.0-beta.22
11 months ago
16.0.0-beta.20
1 year ago
17.0.0-beta.20
2 years ago
16.0.0-beta.19
2 years ago
14.0.0-beta.17
3 years ago
15.0.0-beta.18
3 years ago
13.0.0-beta.16
4 years ago
13.0.0-beta.15
4 years ago
13.0.0-beta.13
4 years ago
13.0.0-beta.12
4 years ago
13.0.0-beta.14
4 years ago
13.0.0-beta.11
4 years ago
13.0.0-beta.10
4 years ago
13.0.0-beta.8
4 years ago
13.0.0-beta.7
4 years ago
13.0.0-beta.9
4 years ago
13.0.0-beta.6
4 years ago
13.0.0-beta.5
4 years ago
13.0.0-beta.4
4 years ago
13.0.0-beta.3
4 years ago
13.0.0-beta.2
4 years ago
13.0.0-beta.1
4 years ago
13.0.0-beta.0
4 years ago