diff --git a/README.md b/README.md index 04f133ea..4beeb486 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ Support for OAuth 2 and OpenId Connect (OIDC) in Angular. Already prepared for t - Source Code Documentation: [https://manfredsteyer.github.io/angular-oauth2-oidc/docs](https://manfredsteyer.github.io/angular-oauth2-oidc/docs) - Community-provided sample implementation: [https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/](https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/) - ## Tested Environment Successfully tested with **Angular 4.3 to Angular 16** and its Router, PathLocationStrategy as well as HashLocationStrategy and CommonJS-Bundling via webpack. @@ -119,10 +118,9 @@ _redirectUris:_ npm i angular-oauth2-oidc --save ``` - ## Option 1: Standalone APIs -If you use Standalone Components introduced with Angular 14, you can use our standalone API (call to ``provideOAuthClient``) in your ``main.ts`` to setup the ``OAuthClient``: +If you use Standalone Components introduced with Angular 14, you can use our standalone API (call to `provideOAuthClient`) in your `main.ts` to setup the `OAuthClient`: ```TypeScript // main.ts -- Angular 15+ version @@ -141,7 +139,7 @@ bootstrapApplication(AppComponent, { }); ``` -As Angular 14 does have Standalone Components but no Standalone API for its ``HttpClient``, you need to go with the traditional ``HttpClientModule`` in this version: +As Angular 14 does have Standalone Components but no Standalone API for its `HttpClient`, you need to go with the traditional `HttpClientModule` in this version: ```TypeScript // main.ts -- Angular 14 version @@ -161,7 +159,7 @@ bootstrapApplication(AppComponent, { }); ``` -The ``provideOAuthClient`` function takes the same parameters as the forRoot function of the OAuthModule that is still in place for the sake of compatibility with existing code bases. +The `provideOAuthClient` function takes the same parameters as the forRoot function of the OAuthModule that is still in place for the sake of compatibility with existing code bases. ## Option 2: Using NgModules @@ -248,7 +246,7 @@ this.oauthService.loadDiscoveryDocumentAndTryLogin(); ### Logging out -The logOut method clears the used token store (by default ``sessionStorage``) and forwards the user to the auth servers logout endpoint if one was configured (manually or via the discovery document). +The logOut method clears the used token store (by default `sessionStorage`) and forwards the user to the auth servers logout endpoint if one was configured (manually or via the discovery document). ```typescript this.oauthService.logOut(); @@ -281,6 +279,22 @@ OAuthModule.forRoot({ If you need more versatility, you can look in the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-documentation/working-with-httpinterceptors.html) how to setup a custom interceptor. +In case you are in a standalone application, you have to use provideHttpClient`with`defaultOAuthInterceptor`. + +```Typescript +bootstrapApplication(App, { + providers: [ + provideOAuthClient({ + resourceServer: { + allowedUrls: ['http://www.angular.at/api'], + sendAccessToken: true + } + }), + provideHttpClient(withInterceptors([defaultOAuthInterceptor])) + ] +}) +``` + ## Token Refresh See docs: https://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-documentation/refreshing-a-token.html @@ -297,13 +311,14 @@ Nowadays, using code flow + PKCE -- as shown above -- is the recommended OAuth 2 See the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/docs/) for more information about this library. - ## Breaking Change in Version 9 With regards to tree shaking, beginning with version 9, the `JwksValidationHandler` has been moved to a library of its own. If you need it for implementing **implicit flow**, please install it using npm: ``` + npm i angular-oauth2-oidc-jwks --save + ``` After that, you can import it into your application by using this: @@ -320,8 +335,6 @@ import { JwksValidationHandler } from 'angular-oauth2-oidc'; Please note, that this dependency is not needed for the **code flow**, which is nowadays the **recommended** flow for single page applications. This also results in smaller bundle sizes. - - ### Breaking change in 9.1.0 The use of `encodeURIComponent` on the argument passed to `initImplicitFlow` and its Code Flow counterparts was mandatory before this version. @@ -379,5 +392,3 @@ Now the reverse is true **if you're upgrading from before 9.0.0**: you need to r [mabdelaal86](https://github.com/mabdelaal86)[nhance](https://github.com/nhance)[Razzeee](https://github.com/Razzeee)[maxisam](https://github.com/maxisam)[ismcagdas](https://github.com/ismcagdas) [Toxicable](https://github.com/Toxicable)[ManuelRauber](https://github.com/ManuelRauber)[vdveer](https://github.com/vdveer)[jeroenheijmans](https://github.com/jeroenheijmans)[manfredsteyer](https://github.com/manfredsteyer) - - diff --git a/docs/changelog.html b/docs/changelog.html index 8dbcfcf4..3589e350 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -12,10 +12,61 @@ - -