Open Closed

Redirecting to IdentityServer login page instead of Angular login page #8314


User avatar
0
Repunjay_TASC created
  • ABP Framework version: 8.3.1

  • UI Type: Angular

  • Database System: EF Core (PostgreSQL)

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  1. Once I run the below base URL in the browser, instead of loading the Angular login page, the IdentityServer login page is loaded.

For your reference pls find attached screen shot.
image.png

After adding the redirectUri and responseType parameters in my environment.ts file as part of the SSO OIDC integration, the SSO OIDC integration is working as expected. However, it is breaking the existing functionality.

If I comment out the redirectUri parameter, my Angular login page loads successfully. However, without commenting out the redirectUri parameter, how can I handle both scenarios: the normal user login page and the SSO OIDC login functionality?

const baseUrl = 'http://localhost:4200';
const oAuthConfig = {
  issuer: 'https://localhost:44350/',
  redirectUri: baseUrl,
  clientId: '',
  responseType: 'code',
  scope: 'offline_access ',
  requireHttps: true,
  showDebugInformation: true,
  requireHttps: true,
};

7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The Angular login page is not supported for external login support, so you have to redirect to the IdentityServer first.

  • User Avatar
    0
    Repunjay_TASC created

    Ok got it.

    In my existing application, I want to handle two approaches:

    1.Users are able to log in using the ABP Angular page (these are not external users).
    
    2.Some of our users are external users and need to log in via SSO (external login).
    

    To enable external login using SSO, I have added the following code in the home module.
    image.png

    This ensures that whenever a user visits the specified URL, they are automatically redirected to the external login page. After authentication, the user is redirected back to the ABP auth server, and this functionality is working as expected.

    like this ticket.
    https://abp.io/support/questions/7788/Custom-Redirection-to-third-party-IdP-Login-Page-and-Dashboard-Post-Authentication-in-ABPIO?CurrentPage=2

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I because it is difficult to implement

    Users are able to log in using the ABP Angular page (these are not external users).
    Some of our users are external users and need to log in via SSO (external login).

    How do you know which method the user should use when they are not logged in?

  • User Avatar
    0
    Repunjay_TASC created

    Hi,

    I because it is difficult to implement

    Users are able to log in using the ABP Angular page (these are not external users).

    We will make it very simple .

    **1. If I comment out the parameters redirectUri: baseUrl and responseType: 'code' from the environment.ts file, the Angular login page loads successfully. **
    image.png

    Like below
    image.png

    Note: The application is already running live using the first approach.

    Some of our users are external users and need to log in via SSO (external login).

    How do you know which method the user should use when they are not logged in?

    2. For sso oidc integration angular side i have added below code changes.

    redirectUri: baseUrl and responseType: 'code' added in environment.ts file.

    image.png

    We have a requirement where we provide a URL to the client, like below:
    http://localhost:4200/?idp=oidc
    Whenever a user visits the specified URL, they should first land on the home module, and I have added the following code.

    image.png

    Check the condition, and if it matches, they are automatically redirected to the external login page.
    After authentication, the user is redirected back to the ABP auth server then we cross check user exists or not , then we add user in DB with role and redirected to angular and this functionality is working as expected.

    Exception: If I comment out image.png from the environment.ts file, the first approach works as expected. However, for SSO, setting redirectUri: baseUrl is mandatory for successful SSO integration.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I'm not sure, but you can try to dynamically change the environment configuration
    https://abp.io/docs/latest/framework/ui/angular/environment

    ABP gets oAuthConfig from EnvironmentService
    https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/services/environment.service.ts

  • User Avatar
    0
    Repunjay_TASC created

    I am also trying the same on the Angular side. Let's see if it works or not.

  • User Avatar
    0
    Repunjay_TASC created

    Issue got resolved

    thanks

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 10, 2025, 12:38