Skip to content

Integrating with AngularJS

Terminal window
npm install @authaction/web-sdk
main.ts
import { provideAuthAction } from "@authaction/web-sdk/angular";
bootstrapApplication(AppComponent, {
providers: [
provideAuthAction({
domain: "myapp.eu.authaction.com",
clientId: "your-client-id",
redirectUri: "http://localhost:4200/",
}),
],
});
app.component.ts
import { AuthActionService } from '@authaction/web-sdk/angular';
@Component({ ... })
export class AppComponent {
constructor(public auth: AuthActionService) {}
}
<button (click)="auth.loginWithRedirect()">Login</button>
<span *ngIf="auth.isAuthenticated$ | async">{{ (auth.user$ | async)?.name }}</span>

Full SDK reference: github.com/authaction/authaction-web-sdk