@alexanderpilhar did you ever figure out a good approach on this? Are you able to share?
@SperseDev did you ever figure out a good solution for this?
I also want to do something similar between our ASP.NET Zero (.net core and Angular version) to be the identity server and then we have an existing ASP.NET MVC project that I would like to authenticate to the Zero Identity server to create a SSO between the two.
@ismcagdas have you guys done anything like this before? The Web.Public project isn't using Identity Server I noticed and is using kind of a home grown SSO option from what I can see. But I would like to use Identityserver Hybrid Flow between our legacy MVC project and our ASP.NET Zero Project.
Excellent, thank you
Where do I set the Token Session Timeout?
Sounds good. Thank you
Unfortunately that didn't work either.
I think I might try something like this since it was made for Angular <a class="postlink" href="https://www.npmjs.com/package/@ng-idle/core">https://www.npmjs.com/package/@ng-idle/core</a>
No Problem.
private tryGoogleLogin() {
for (let provider of this.externalLoginProviders) {
if (provider.name === ExternalLoginProvider.GOOGLE) {
this.googleProvider = provider;
}
}
if (this.googleProvider != null || this.googleProvider != undefined) {
this.externalLogin(this.googleProvider);
}
}
Yes I did, I tried it two different ways since I am not 100% sure how the typings.d.ts actually works.
I tried it this way.
interface JQuery {
sessionTimeout(...any): any;
}
and this way...
declare var sessionTimeout: any; //related to session timeout
But still the same error.
I would like to add this utility to the Angular app but having a hard time with it. <a class="postlink" href="http://keenthemes.com/metronic/preview/?page=components/utils/session-timeout&demo=default">http://keenthemes.com/metronic/preview/ ... mo=default</a>
I wanted to add this to the header.component.ts file
sessionTimeout() : void{
$.sessionTimeout({
title: 'Session Timeout Notification',
message: 'Your session is about to expire.',
keepAliveUrl: AppConsts.remoteServiceBaseUrl + 'KeepAlive',
logoutUrl: this.logout(),
warnAfter: 3000, //warn after 5 seconds
redirAfter: 35000, //redirect after 10 secons,
ignoreUserActivity: true,
countdownMessage: 'Redirecting in {timer} seconds.',
countdownBar: true
});
};
I also tried something like this private _$sessionTimeout: JQuery;
sessionTimeout() : void{
this._$sessionTimeout.sessionTimeout({
title: 'Session Timeout Notification',
message: 'Your session is about to expire.',
keepAliveUrl: AppConsts.remoteServiceBaseUrl + 'KeepAlive',
logoutUrl: this.logout(),
warnAfter: 3000, //warn after 5 seconds
redirAfter: 35000, //redirect after 10 secons,
ignoreUserActivity: true,
countdownMessage: 'Redirecting in {timer} seconds.',
countdownBar: true
});
};
I also added this "./assets/metronic/src/vendors/bootstrap-session-timeout/dist/bootstrap-session-timeout.js" to the .angular-cli.json file but the $.sessionTimeout() function cannot be found in the header.component.ts file.
This is the error I am getting. ERROR TypeError: Cannot read property 'sessionTimeout' of undefined at HeaderComponent.sessionTimeout (header.component.ts:304) at HeaderComponent.ngOnInit (header.component.ts:122) at checkAndUpdateDirectiveInline (core.js:12400) at checkAndUpdateNodeInline (core.js:13927) at checkAndUpdateNode (core.js:13870) at debugCheckAndUpdateNode (core.js:14763) at debugCheckDirectivesFn (core.js:14704) at Object.eval [as updateDirectives] (AppComponent.html:3) at Object.debugUpdateDirectives [as updateDirectives] (core.js:14689) at checkAndUpdateView (core.js:13836)
Can anyone help me with what I am doing wrong?
@ismcagdas thank you as always for the awesome help. It took a combination of the below code but now its working good.
ngAfterViewInit(): void {
this.initExternalLoginProviders();
setTimeout(() => {
this.tryGoogleLogin();
}, 100);
}
One more question. I was trying to switch from having the pop-up window to it redirecting in the same window. I added the uxMode but it just gets into a redirect loop. Would you have any idea how to handle this?
gapi.client.init({
clientId: loginProvider.clientId,
scope: 'openid profile email',
uxMode: 'redirect',
redirectUri: AppConsts.appBaseUrl
})