Hi,
I have two Applications one for Login and Another for users (Angular with Web API). User logs in with Login Application, after login they are redirected to another application where they will not be authenticated again. I tried to pass Token from Application one to the second but was not successfull. Is there any other method to acheive this? first application is login.xyz.com and second one is main.xyz.com. Is there any chance for Open Authentication? or can be solved by other simple methods? Please Help
7 Answer(s)
-
0
Hi,
The token is generated here https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/TokenAuthController.cs#L611 and configured here https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/AbpZeroTemplateWebCoreModule.cs#L92
So, if you are using same token configuration for both sites, it should work.
-
0
Ok, but how can I pass and receive token in two aspnetzero application?
-
0
Hi @shimi
You have to do it manually. After your user logins on first app you get a token which is written to cookie. You can send this token to your second app via query string, get it from query string on your second app and store it on the cookie to use it for the second app.
You need to manually do sending via query string and getting it from query string.
-
0
That is okay I am receving token in second app also but where to receive the token in login page or in some other service so that it canot promp user to login again
-
0
Store it in the cookie on the second app's client side.
-
0
That is okay, consider first application passes token to second application in querystring, the first problem is we can access query string in constructor of login page, before that GetAll() and GetCurrentLoginInformations function will call so only chance is to reload login page again with new cooke value in second app. The question is "Is there any way to access token query string before it reaches constructor of that particular component"
-
0
You can do it in the run method of https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/src/AppPreBootstrap.ts
Sorry for the late reply, I thouht your problem has been solved.