All Projects → damienbod → Angular Auth Oidc Client

damienbod / Angular Auth Oidc Client

Licence: other
npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Angular Auth Oidc Client

Product Is
Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
Stars: ✭ 435 (-24.61%)
Mutual labels:  hacktoberfest, authentication, oauth2, identity
Fosite
Extensible security first OAuth 2.0 and OpenID Connect SDK for Go.
Stars: ✭ 1,738 (+201.21%)
Mutual labels:  hacktoberfest, authentication, oauth2, auth
Aspnet5identityserverangularimplicitflow
OpenID Connect Code / Implicit Flow with Angular and ASP.NET Core 5 IdentityServer4
Stars: ✭ 670 (+16.12%)
Mutual labels:  authentication, oauth2, identity, openid
Hydra
OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+1959.62%)
Mutual labels:  hacktoberfest, oauth2, identity, openid
Django Oidc Provider
OpenID Connect and OAuth2 provider implementation for Djangonauts.
Stars: ✭ 320 (-44.54%)
Mutual labels:  authentication, oauth2, identity, openid
Vue Authenticate
Simple Vue.js authentication library
Stars: ✭ 1,350 (+133.97%)
Mutual labels:  authentication, oauth2, auth
External Auth Server
easy auth for reverse proxies
Stars: ✭ 189 (-67.24%)
Mutual labels:  authentication, oauth2, openid
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+37.95%)
Mutual labels:  hacktoberfest, authentication, oauth2
Salte Auth
💻🗝 Authentication for the modern web!
Stars: ✭ 61 (-89.43%)
Mutual labels:  authentication, oauth2, openid
Aura.auth
Provides a unified interface to local and remote authentication systems.
Stars: ✭ 121 (-79.03%)
Mutual labels:  hacktoberfest, authentication, oauth2
Auth
:atom: Social (OAuth1\OAuth2\OpenID\OpenIDConnect) sign with PHP
Stars: ✭ 457 (-20.8%)
Mutual labels:  oauth2, openid, openidconnect
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+115.77%)
Mutual labels:  authentication, oauth2, identity
Oauth2 Oidc Debugger
An OAuth2 and OpenID Connect Debugger
Stars: ✭ 78 (-86.48%)
Mutual labels:  authentication, oauth2, openidconnect
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+302.6%)
Mutual labels:  authentication, oauth2, identity
Cas
Apereo CAS - Enterprise Single Sign On for all earthlings and beyond.
Stars: ✭ 9,154 (+1486.48%)
Mutual labels:  authentication, oauth2, openidconnect
Flask simplelogin
Simple Login - Login Extension for Flask - maintainer @cuducos
Stars: ✭ 133 (-76.95%)
Mutual labels:  hacktoberfest, authentication, auth
logto
🧑‍🚀 Logto helps you build the sign-in, auth, and user identity within minutes. We provide an OIDC-based identity service and the end-user experience with username, phone number, email, and social sign-in, with extendable multi-language support.
Stars: ✭ 3,421 (+492.89%)
Mutual labels:  identity, oauth2, auth
Play Silhouette
Silhouette is an authentication library for Play Framework applications that supports several authentication methods, including OAuth1, OAuth2, OpenID, CAS, 2FA, TOTP, Credentials, Basic Authentication or custom authentication schemes.
Stars: ✭ 826 (+43.15%)
Mutual labels:  authentication, oauth2, openid
Node Oidc Provider
OpenID Certified™ OAuth 2.0 Authorization Server implementation for Node.js
Stars: ✭ 2,018 (+249.74%)
Mutual labels:  hacktoberfest, oauth2, openid
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (-69.84%)
Mutual labels:  oauth2, openidconnect, openid

Angular Lib for OpenID Connect & OAuth2

Build Status npm npm npm code style: prettier Coverage Status

OpenID Code Flow with PKCE, Code Flow with refresh tokens, OpenID Connect Implicit Flow

OpenID Certification

This library is certified by OpenID Foundation. (RP Implicit and Config RP)

Features

Installation

Ng Add

You can use the schematics and ng add the library.

ng add angular-auth-oidc-client

And answer the questions. A module will be created which encapsulates your configuration.

angular-auth-oidc-client schematics

Npm / Yarn

Navigate to the level of your package.json and type

 npm install angular-auth-oidc-client

or with yarn

 yarn add angular-auth-oidc-client

Documentation

Quickstart

For the example of the Code Flow. For further examples please check the Samples Section

NOTE If you have done the installation with the schematics, these modules and files should be available already!!!

If the schematics did not do this already: Import the module and services in your module.

import { HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { AuthModule, LogLevel, OidcConfigService } from 'angular-auth-oidc-client';
// ...

export function configureAuth(oidcConfigService: OidcConfigService) {
  return () =>
    oidcConfigService.withConfig({
      stsServer: '<your sts address here>',
      redirectUrl: window.location.origin,
      postLogoutRedirectUri: window.location.origin,
      clientId: 'angularClient',
      scope: 'openid profile email',
      responseType: 'code',
      silentRenew: true,
      silentRenewUrl: `${window.location.origin}/silent-renew.html`,
      logLevel: LogLevel.Debug,
    });
}

@NgModule({
  // ...
  imports: [
    // ...
    AuthModule.forRoot(),
  ],
  providers: [
    OidcConfigService,
    {
      provide: APP_INITIALIZER,
      useFactory: configureAuth,
      deps: [OidcConfigService],
      multi: true,
    },
  ],
  // ...
})
export class AppModule {}

And call the method checkAuth() from your app.component.ts. The method checkAuth() is needed to process the redirect from your sts and set the correct states. This method must be used to ensure the correct functioning of the library.

import { Component, OnDestroy, OnInit } from '@angular/core';
import { OidcClientNotification, OidcSecurityService, PublicConfiguration } from 'angular-auth-oidc-client';
import { Observable } from 'rxjs';

@Component({
  /**/
})
export class AppComponent implements OnInit {
  constructor(public oidcSecurityService: OidcSecurityService) {}

  ngOnInit() {
    this.oidcSecurityService.checkAuth().subscribe((auth) => console.log('is authenticated', auth));
  }

  login() {
    this.oidcSecurityService.authorize();
  }

  logout() {
    this.oidcSecurityService.logoff();
  }
}

Using the access token

You can get the access token by calling the method getToken() on the OidcSecurityService

const token = this.oidcSecurityService.getToken();

And then you can use it in the HttpHeaders

import { HttpHeaders } from '@angular/common/http';

const token = this.oidcSecurityServices.getToken();

const httpOptions = {
  headers: new HttpHeaders({
    Authorization: 'Bearer ' + token,
  }),
};

License

MIT

Version 10

if you need information about version 10 please search here

https://github.com/damienbod/angular-auth-oidc-client/tree/version-10

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].