Gathering detailed insights and metrics for angular-auth-oidc-client
Gathering detailed insights and metrics for angular-auth-oidc-client
Gathering detailed insights and metrics for angular-auth-oidc-client
Gathering detailed insights and metrics for angular-auth-oidc-client
@aws-sdk/client-sso-oidc
AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native
angular-oauth2-oidc
Support for OAuth 2 and OpenId Connect (OIDC) in Angular. Already prepared for the upcoming OAuth 2.1.
react-oidc-context
OpenID Connect & OAuth2 authentication using react context api as state management
angular-oauth2-oidc-jwks
Support for OAuth 2 and OpenId Connect (OIDC) in Angular. Already prepared for the upcoming OAuth 2.1.
npm install angular-auth-oidc-client
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,153 Stars
4,229 Commits
435 Forks
36 Watching
10 Branches
91 Contributors
Updated on 25 Nov 2024
TypeScript (86.91%)
JavaScript (10.21%)
HTML (2.61%)
CSS (0.28%)
Cumulative downloads
Total Downloads
Last day
-0.5%
14,753
Compared to previous day
Last week
-0.9%
70,811
Compared to previous week
Last month
3.9%
303,808
Compared to previous month
Last year
45.3%
3,050,037
Compared to previous year
4
Secure your Angular app using the latest standards for OpenID Connect & OAuth2. Provides support for token refresh, all modern OIDC Identity Providers and more.
This library is certified by OpenID Foundation. (RP Implicit and Config RP)
ng add
supportYou can use the schematics and ng add
the library.
1ng add angular-auth-oidc-client
And answer the questions. A module will be created which encapsulates your configuration.
Navigate to the level of your package.json
and type
1 npm install angular-auth-oidc-client
or with yarn
1 yarn add angular-auth-oidc-client
For the example of the Code Flow. For further examples please check the Samples Section.
If you have done the installation with the schematics, these modules and files should be available already!
Import the AuthModule
in your module.
1import { NgModule } from '@angular/core';
2import { AuthModule, LogLevel } from 'angular-auth-oidc-client';
3// ...
4
5@NgModule({
6 // ...
7 imports: [
8 // ...
9 AuthModule.forRoot({
10 config: {
11 authority: '<your authority address here>',
12 redirectUrl: window.location.origin,
13 postLogoutRedirectUri: window.location.origin,
14 clientId: '<your clientId>',
15 scope: 'openid profile email offline_access',
16 responseType: 'code',
17 silentRenew: true,
18 useRefreshToken: true,
19 logLevel: LogLevel.Debug,
20 },
21 }),
22 ],
23 // ...
24})
25export class AppModule {}
And call the method checkAuth()
from your app.component.ts
. The method checkAuth()
is needed to process the redirect from your Security Token Service and set the correct states. This method must be used to ensure the correct functioning of the library.
1import { Component, OnInit, inject } from '@angular/core'; 2import { OidcSecurityService } from 'angular-auth-oidc-client'; 3 4@Component({ 5 /*...*/ 6}) 7export class AppComponent implements OnInit { 8 private readonly oidcSecurityService = inject(OidcSecurityService); 9 10 ngOnInit() { 11 this.oidcSecurityService 12 .checkAuth() 13 .subscribe((loginResponse: LoginResponse) => { 14 const { isAuthenticated, userData, accessToken, idToken, configId } = 15 loginResponse; 16 17 /*...*/ 18 }); 19 } 20 21 login() { 22 this.oidcSecurityService.authorize(); 23 } 24 25 logout() { 26 this.oidcSecurityService 27 .logoff() 28 .subscribe((result) => console.log(result)); 29 } 30}
You can get the access token by calling the method getAccessToken()
on the OidcSecurityService
1const token = this.oidcSecurityService.getAccessToken().subscribe(...);
And then you can use it in the HttpHeaders
1import { HttpHeaders } from '@angular/common/http'; 2 3const token = this.oidcSecurityServices.getAccessToken().subscribe((token) => { 4 const httpOptions = { 5 headers: new HttpHeaders({ 6 Authorization: 'Bearer ' + token, 7 }), 8 }; 9});
You can use the built in interceptor to add the accesstokens to your request
1AuthModule.forRoot({
2 config: {
3 // ...
4 secureRoutes: ['https://my-secure-url.com/', 'https://my-second-secure-url.com/'],
5 },
6}),
1 providers: [ 2 { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }, 3 ],
Current Version is Version 18.x
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
30 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 13/14 approved changesets -- score normalized to 9
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More