13.0.0-beta.0 • Published 5 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-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.19
5 months ago
14.0.0-beta.17
1 year ago
15.0.0-beta.18
1 year ago
13.0.0-beta.16
2 years ago
13.0.0-beta.15
2 years ago
13.0.0-beta.13
2 years ago
13.0.0-beta.12
2 years ago
13.0.0-beta.14
2 years ago
13.0.0-beta.11
2 years ago
13.0.0-beta.10
2 years ago
13.0.0-beta.8
2 years ago
13.0.0-beta.7
2 years ago
13.0.0-beta.9
2 years ago
13.0.0-beta.6
2 years ago
13.0.0-beta.5
2 years ago
13.0.0-beta.4
2 years ago
13.0.0-beta.3
2 years ago
13.0.0-beta.2
2 years ago
13.0.0-beta.1
2 years ago
13.0.0-beta.0
2 years ago