Starts in:
2 DAYS
12 HRS
55 MIN
19 SEC
Starts in:
2 D
12 H
55 M
19 S
Open Closed

Single sign on with Razor and angular #833


User avatar
0
thanhvl1 created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.3.1
  • UI type: Angular , MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue: I have 2 page one is angular and another is razor First i go to page in angular to login It's login succes and redirect to my home page i created in IdentityServer web with razor but when i click buton to go to page in angular, my page in angular is not login

How can I log into the razor site in IdentityServer and press the button it points to the angular page that is already logged in?


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @thanhvl1@fsoft.com.vn

    How do we reproduce the problem?

  • User Avatar
    0
    thanhvl1 created
    • I created HomePage.cshtml in IdentityWeb.
    • I added redirectUri in enviroment.ts (Angular) to after login i can go to HomePage.cshtml
    • From my angular site i click login
    • When I login success i click button report to go to my angular site. My code is: <a href="https://localhost:4200" style="color:white; font-family:SourceSansPro-Bold" class="button">REPORT </a> but when it redirect to angular site. It not login
  • User Avatar
    0
    Mehmet created

    Hello,

    After successfully logging in, IdentityServer redirects to the Angular application with query parameters such as:

    https://localhost:4200?code=0C8C15544759F0A0DBA87B96402429511AF79BDFAD3461ADDA4B37AADBA25DA4&scope=openid%20AbpCommercialDemo&state=YUJLMWhlaEx6SG9saVFrRzQ0YWpsUEJ4eFdqSGxvaUdXdTVkS2VaXzM3ckd6&session_state=kVJPuS3Fa7ZtS8IwiyENThPSppljkE7-2NDoBi5LQfs.FD923014BDF36DBC68E30B148A0169C4

    The angular-oauth2-oidc package installed in Angular UI use these query params to get access token by performing an HTTP call to the IdentityServer.

    If you redirect to Angular without the query params, the app cannot get an access token.

  • User Avatar
    0
    thanhvl1 created

    Hi Mehmet How i can get query parameters on razor page after login?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi thanhvl1

    You can't be automatically redirected to a specific page after successful login in Angular.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06