pythonmsal

Specify browser for login


I am writing a python script to query something from graph. I am using MSAL for python to get the login and get the token. When using acquire_token_interactive the login prompt will redirect to my main browser. But I need to use a different browser for multiple reasons.

Is there a way to tell the script for example to use a specific browser or something like that?


Solution

  • So I found in the code that MSAL is using webbrowser. You can set the environment variable BROWSER and then MSAL will use that browser.

    For example for edge:

    import os
    os.environ["BROWSER"] = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
    

    Did not found a way to pass the browser name as parameter to any MSAL function.