In this article we are going to look at how to handle authenticating with playwright end-to-end automated tests using the microsoft authentication library
To avoid bad practices such as disabling authentication, the article suggests directly acquiring the tokens via a REST API call using the ROPC approach.
The article outlines the steps to set up Azure, building a token factory and putting all of this together in an authentication.ts file.
The article also provides a special note that the token expires within 72 minutes, and suggests either figuring out a caching mechanism or keeping the test files under one hour run time.