source-inc / ng-oidc-client Goto Github PK
View Code? Open in Web Editor NEWA package for managing OpenID-Connect authentication in Angular apps, wrapping oidc-client-js
License: MIT License
A package for managing OpenID-Connect authentication in Angular apps, wrapping oidc-client-js
License: MIT License
running ng build --prod
results in following error message:
ERROR in : Can't resolve all parameters for OidcFacade in .../ClientApp/node_modules/ng-oidc-client/ng-oidc-client.d.ts: (?).
Describe the bug
https://github.com/sourcenetwork/ng-oidc-client/blob/b4f0e7d247cbf47e0372798857e216781360008c/projects/ng-oidc-client/src/lib/effects/oidc.effect.ts#L3
Warning: Entry point 'ng-oidc-client' contains deep imports into 'node_modules/@ngrx/store/src/models'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
This Action should be imported from '@ngrx/store' and ngcc doesn't return a Warning
Additional context
> ng "version"
Angular CLI: 9.0.5
Node: 13.8.0
OS: darwin x64
Angular: 9.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.900.5
@angular-devkit/build-angular 0.900.5
@angular-devkit/build-optimizer 0.900.5
@angular-devkit/build-webpack 0.900.5
@angular-devkit/core 9.0.5
@angular-devkit/schematics 9.0.5
@angular/cdk 9.1.1
@angular/material 9.1.1
@ngtools/webpack 9.0.5
@schematics/angular 9.0.5 (cli-only)
@schematics/update 0.900.5
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
return this.oidcFacade.waitForAuthenticationLoaded().pipe(
switchMap(() => {
return this.oidcFacade.identity$.pipe(
Expected behavior
This was fine in Angular 8, but no longer working in Angular 9?
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Does the product support Angular 9?
I am using oidc-client and ng-oidc-client combination for angular client and Identity server 4 as server.
Login was successful but this.oidcFacade.identity$.pipe is always returning null User object after login.
When first subscribe the identity$, there always have a null value first. Can remove the initial null value?
Hello,
I've encountered a problem when using this library through npm.
The file node_modules\ng-oidc-client\fesm5\ng-oidc-client.js
contains the following import:
import { InjectionToken, Injectable, Inject, PLATFORM_ID, ɵɵdefineInjectable, ɵɵinject, NgModule } from '@angular/core';
It throws several warnings like the one below when building:
WARNING in C:/Code/ocCore/Clients/angular/node_modules/ng-oidc-client/fesm5/ng-oidc-client.js 620:53-71
"export 'ɵɵdefineInjectable' was not found in '@angular/core'
This char is wrong: ɵɵ
. If you remove it, everything works as expected.
Why does the file contain that char? Wrong code published to npm?
packages:
"@angular/core": "^7.2.15",
"ng-oidc-client": "^1.0.6",
"oidc-client": "^1.9.1",
On your docs you use HTML files for callbacks:
src/static
├── callback.html
├── renew-callback.html
└── signout-callback.html
Can't Angular components be uses instead of static HTML files?
Why use HTML files?
Does not work with lazy loading modules (ngrx)
I used => this.oidcFacade.getOidcUser(); in OidcGuardService
export class OidcGuardService implements CanActivate {
constructor(private router: Router, private oidcFacade: OidcFacade) { }
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
this.oidcFacade.getOidcUser();
return this.oidcFacade.waitForAuthenticationLoaded().pipe(
switchMap(loading => {
return this.oidcFacade.identity$.pipe(
first(),
switchMap(user => {
if (user && !user.expired) {
return of(true);
} else {
this.router.navigate(['/home']);
return of(false);
}
})
);
})
);
}
}
My routing module:
{
path: 'employee',
loadChildren: () => import('@employee').then(m => m.EmployeeModule),
canActivate: [OidcGuardService],
runGuardsAndResolvers: 'always'
}
I have on the village filters, sorting, pagination which by change causes action load data.
When pressed, endless loading occurs. The action works, but does not cause the next action
if I add it => this.oidcFacade.getOidcUser(), everything will work.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (if required for specific bug, please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
ResponseValidator._processSigninParams: Expecting code in response
i get problem in function of signinRedirectCallback that function throws Expecting code in response like error.. below is my configuration for OIDC in app.module.ts file
NgOidcClientModule.forRoot({
oidc_config: {
authority:
'http://172.16.23.104:4444',
client_id: 'js',
redirect_uri: 'http://localhost:4200/callback.html',
response_type: 'code',
scope: 'openid profile positions',
post_logout_redirect_uri:
'http://localhost:4200/signout-callback.html',
silent_redirect_uri: 'http://localhost:4200/renew-callback.html',
acr_values: 'tenant:EDF',
userStore: () => new WebStorageStateStore({store: localStorage}),
}
}),
and in login i simply call:- this.oidcFacade.signinRedirect();
and in callback.html file
<title>Callback</title> <script src="oidc-client.min.js" type="application/javascript"></script> <script> var Oidc = window.Oidc;var config = {
userStore: new Oidc.WebStorageStateStore({ store: window.localStorage })
}
if ((Oidc && Oidc.Log && Oidc.Log.logger)) {
Oidc.Log.logger = console;
}
var isPopupCallback = JSON.parse(window.localStorage.getItem('ngoidc:isPopupCallback'));
if (isPopupCallback) {
new Oidc.UserManager(config).signinPopupCallback();
} else {
new Oidc.UserManager(config).signinRedirectCallback().then(t => {
window.location = 'http://localhost:4200';
}).catch((e) => {
console.log(e);
});
}
</script>
Desktop (please complete the following information):
When using signingRedirect
and passing in some state, the state is not set in the callback.
For example:
Callling oidcFacade.signinRedirect({ state: { returnUrl: window.location.href } });
and then trying to read the state in the callback from a HTML template for example:
var config = {
userStore: new Oidc.WebStorageStateStore({ store: window.localStorage }),
};
var mgr = new Oidc.UserManager(config);
mgr.signinRedirectCallback().then(
function (user) {
console.log(user);
});
The user doesn't have the state that was passed in to signinRedirect
, it is set to undefined
. I have tried with response_mode
query and also to set data: {}
with the signinRedirect
.
Hi, your help is greatly appreciated.
I am struck in finding a way to resend failed requests (401 unauthorized) captured while renewing token (silent refresh) through httpInterceptor.
I have httpInteceptor in place to attach bearer token to all outgoing web requests. When the token is expired, I get 401 unauthorized response from web server. I am catching these unauthorized request/responses and requesting for renewing token through silentSignin method from ng-oidc-client.
Silent renewal is happening through asynchronous call. I am not sure on how to resend failed requests with the renewed token. Any help on this is highly valuable for me. I tried re sending failed requests through setTimeOut, unfortunately requests are not getting captured under network tab.
Describe the bug
The OidcUser payload violates the new strictActionSerializability check in NgRx 8
export class UserFound implements Action {
readonly type = OidcActionTypes.UserFound;
constructor(public payload: OidcUser) {}
}
To Reproduce
Steps to reproduce the behavior:
@NgModule({
imports: [
StoreModule.forRoot(reducers, {
runtimeChecks: {
strictStateImmutability: true,
strictActionImmutability: true,
strictStateSerializability: true,
strictActionSerializability: true,
},
}),
],
})
Expected behavior
[Oidc] User found action should complete without runtime error
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
We are currently loading our configuration from a local asset. When deploying the application we can change the configuration before building and deploying within our CI pipeline. However, the build for our staging and production servers needs to be identical, so the configuration needs loading at run-time.
Describe the solution you'd like
Modify the library to support the loading of the configuration at run-time.
Describe alternatives you've considered
Loading the configuration from an external service, then using the Angular APP_INITIALIZER to inhibit the initialisation process until loaded. There have been problems with this approach, so currently isn't working.
Additional context
Looks as if the ng8 branch is supporting this feature? Will this be released and if so when?
Describe the bug
When the token gets refreshed all previous requests are fired again.
The request is a normal HTTP call, nothing fancy.
Expected behavior
The token call is the only call that's made
Screenshots
As you see, a few requests get refired and get cancelled.
Desktop (please complete the following information):
This bug could also come from the OIDC-Client package but i'm not sure.
Describe the bug
First, thank you for amazing library. I have cloned the library locally, replaced oidc_config with my server details. Everything is good. I even checked the code with dummy server online i.e. https://demo.identityserver.io. It is working fine for Popup flow but it is giving error/failing during redirect flow.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The application should redirect to localhost after authentication without error like it is working for a popup.
Screenshots
Desktop (please complete the following information):
Any
Additional context
What could be the issue? Does it require some fix from the code side? Please help.
Sometimes the oidc configuration is not know until runtime. Redirect_uri, authority, may vary depending on the environment.
I would like the Config parameter on the forRoot to be optional and have a method to load configuration on the APP_INITIALIZER.
When updating to Angular 8 I get:
Package "ng-oidc-client" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0-rc.0 || ^6.0.0" (extended), would install "8.2.2").
npm version: 1.0.4
No matter what log level configured, once you logged the console always print logs. Then the browser will dead!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.