Base solution for your next web application
Open Closed

Token Passing between two Angular Application in Asp.NetZero #6691


User avatar
0
shimi created

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

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    shimi created

    Ok, but how can I pass and receive token in two aspnetzero application?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    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.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    shimi created

    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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    aaron created
    Support Team

    Store it in the cookie on the second app's client side.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    shimi created

    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"

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    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.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)