Azure B2C Webapp login for JMeter

Manish Aggarwal 36 Reputation points
2023-02-13T09:04:21.8933333+00:00

Hi Team -

We have recently implemented Azure AD B2C for a spring webapp. Now, we are looking to automate the login in JMeter scripts for automation and performance testings.

Is there a way we can simulate user login in JMeter scripts without manual intervention?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,766 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shweta Mathur 29,746 Reputation points Microsoft Employee
    2023-02-20T04:00:00.01+00:00

    Hi @Manish Aggarwal ,

    Thanks for reaching out.

    You can simulate user login in JMeter scripts without manual intervention by using the Resource Owner Password Credential Grant (ROPC) auth flow.

    ROPC allows you to sign in as a user instead of automating the interactive sign-in prompt UI.

    Once you have set up ROPC, you can use the Microsoft Authentication Library (MSAL) to acquire tokens and call APIs in your JMeter scripts.

    Reference: https://github.com/yoelhor/aadb2c-load-test which is using authorization grant flow. In similar way you can use ROPC flow to simulate JMeter scripts.

    Hope this will help.

    Thanks,

    Shweta


  2. Chris Spanellis 26 Reputation points
    2024-02-07T14:11:44.9566667+00:00

    I answered it in this post.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.