Base solution for your next web application
Open Closed

Set openId Connect as default login #11552


User avatar
0
Hellonote created

Product Version 12.01 Angular .Net Core

Hello Team,

We have a requirement for a tenant to login with openId Connect. So, need to set default login should be by openId connect. We tried by modifying the code on login.component.ts but couldn't make it work. It was going in loop, again and again redirecting to cognito login page.

We request you to kindly help us and guide with sample code to get this done, please.


12 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Hellonote

    You can trigger OpenIDConnect login flow here in the line marked with red arrow in the screenshot below;

    I think in your code, it always triggers openIdConnect login when login page is visited.

  • User Avatar
    0
    Hellonote created

    Hi @ismcagdas

    I did exactly what you said. But after cognito authentication it again comes to this login and then again executing this piece of code. Hence stuck into the loop. I tried to handle it by if conditions but not making any difference

  • User Avatar
    0
    Hellonote created

    Hi @ismcagdas

    Do you have any update on this, please?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Hellonote

    Do you have openIdConnect query string parameter when user is redirected back to your app from OpenId provider ?

  • User Avatar
    0
    Hellonote created

    Hi @ismcagdas

    Yes, this is the redirect url from openId https://localhost:4200/account/login?code=<generatedCode>;openIdConnect%3D1

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I assume the correct URL is https://localhost:4200/account/login?code=<generatedCode>&openIdConnect%3D1. If so, could you chain the if statements using else as shown below ?

    I would be nice if you can share the final modified code for handleExternalLoginCallbacks method.

  • User Avatar
    0
    Hellonote created

    Hi,

    I did chain the if statements as you suggested. The problem still exist. What I notice, After the call back somehow internally it redirects again on https://localhost:4200/account/login . I believe this is causing the issue. Not getting any idea to overcome this.

    Below is the final modified code for your reference:

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Are you able to debug this code ? Is this line hit when user is redirected back from OpenID provider ?

  • User Avatar
    0
    Hellonote created

    Yes, that line is getting hit twice

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Hellonote

    Is it possible to arrange an online meeting ? Could you send an email to [email protected] so we can arrange the meeting ?

  • User Avatar
    0
    Hellonote created

    Hello @ismcagdas

    Yes Please, it will be helpful

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks, we are waiting your email then.