Open Closed

Issue with AD Login #3350


User avatar
0
viswajwalith created
  • ABP Framework version: v5.1
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

We are trying to Use Azure AD integration for Login process and it is working as expected Step 1: User trying to Login with xxx@sample.com Step 2: Azure AD Login page displayed Step 3: Provided the correct info of xxx@sample.com Step 4: Redirected to Register page and clicked on Register Step 5: User Created and logged into Application

but the same is not the case with different scenario

Step 1: Logged in as Admin and created a user with pqr@sample.com and assigned the permissions Step 1: User trying to Login with pqr@sample.com Step 2: Azure AD Login page displayed Step 3: Provided the correct info of pqr@sample.com Step 4: Redirected to Register page and clicked on Register (we assume this shouldn't be the case as we have a user with same username/email, we are expecting to login without any other steps ) Step 5: User Already exists message popped up

In the above case SignInManager.ExternalLoginSignInAsync is returning failed.

Can you please help what might be missing?? Thanks in advance


9 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Can you check the logs?

    Also you can override the SignInManager and debug then see what's going on.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Step 4: Redirected to Register page and clicked on Register

    Did the Register page get your email address?

  • User Avatar
    0
    viswajwalith created

    Step 4: Redirected to Register page and clicked on Register

    Did the Register page get your email address?

    Yes we are getting the email pre populated in Register page

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share your Azure AD integration code. eg AddAuthentication().Add

  • User Avatar
    0
    viswajwalith created

    hi

    Please share your Azure AD integration code. eg AddAuthentication().Add

    Thanks for the quick response, Please find the requested info and let me know if you need anything else.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try to add this options.ClaimActions.MapJsonKey(AbpClaimTypes.Email, "email");

  • User Avatar
    0
    viswajwalith created

    hi

    Try to add this options.ClaimActions.MapJsonKey(AbpClaimTypes.Email, "email");

    Yes we tried both with ClaimTypes and ABPclaimTypes but no luck

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Add UserInformationReceived callback to debug and check the principal.

    options.Events = new OpenIdConnectEvents()
    
    options.Events.UserInformationReceived = ...
    
  • User Avatar
    0
    viswajwalith created

    hi

    Add UserInformationReceived callback to debug and check the principal.

    options.Events = new OpenIdConnectEvents() 
     
    options.Events.UserInformationReceived = ... 
    

    After changing the claim type from ABPClaimType to ClaimType it worked. Means some issue with the Key used.

    var email = loginInfo.Principal.FindFirstValue(ClaimTypes.Email);

    Thanks for the support.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19