@authyo/auth-angular
v1.0.1
Published
Angular wrapper for the Authyo passwordless SDK.
Maintainers
Readme
@authyo/auth-angular
Angular wrapper for the Authyo passwordless SDK. Depends on @authyo/auth-js and exposes an injectable AuthyoService plus provideAuthyo helper.
Install
npm install @authyo/auth-js @authyo/auth-angular
# or
yarn add @authyo/auth-js @authyo/auth-angularPeer dependencies: @angular/core (^16|^17|^18) and rxjs (^7).
Setup
// app.config.ts (standalone) or app.module.ts
import { provideAuthyo } from "@authyo/auth-angular";
import { ApplicationConfig } from "@angular/core";
export const appConfig: ApplicationConfig = {
providers: [
provideAuthyo({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
baseUrl: "https://app.authyo.io" // optional, defaults to this
})
]
};Use in a component/service
import { Component } from "@angular/core";
import { AuthyoService } from "@authyo/auth-angular";
@Component({
selector: "app-auth",
template: `<button (click)="send()">Send OTP</button>`
})
export class AuthComponent {
constructor(private authyo: AuthyoService) {}
send() {
this.authyo
.sendOtp({ to: "[email protected]", authWay: "Email", otpLength: 6 })
.subscribe(res => console.log(res));
}
}API (delegates to @authyo/auth-js)
getConfiguration()— GET/api/v1/user/getappcustomizationsendOtp({ to, authWay, otpLength, expiry, deviceInfo })— POST/api/v1/auth/sendotpverifyOtp(otp, maskId)— GET/api/v1/auth/verifyotpverifyToken(token)— POST/api/v1/auth/verifytokenrevokeSession(token)— POST/api/v1/auth/revokesession
All requests include clientId / clientSecret in headers (configured via provideAuthyo).
Build
npm run buildemits ESM + d.ts todist/
Notes
- Designed for Angular apps; uses RxJS
Observablewrappers around the core SDK promises. - Keep
clientSecretserver-side where possible; avoid exposing it in public client bundles you don’t control.
License
MIT
