Skip to content

Interactive Browser Auth not working on Mac OS #447

@g2vinay

Description

@g2vinay

Describe the bug
When trying to authenticate with Azure via Interactive Browser from a Java/Sprint application, the following error is thrown:

Caused by: com.microsoft.aad.msal4j.MsalClientException: Unable to open default system browser
        at com.microsoft.aad.msal4j.AcquireTokenByInteractiveFlowSupplier.openDefaultSystemBrowser(AcquireTokenByInteractiveFlowSupplier.java:116)
...

And the application halts.

To Reproduce

  • This was ran many times in OSX with the default browser (in the OS) set to Safari, Chrome or Edge.

Code Snippet

        String tenantId = "<Tenant-Id>";
        String clientId = "<Client-Id>";

        String authHostUrl = "https://login.microsoftonline.com/" + tenantId;
        PublicClientApplication publicClientApplication = PublicClientApplication
                .builder(clientId).authority(authHostUrl)
                .build();

        List<String> scopes = new ArrayList<>(1);
        scopes.add("https://vault.azure.net/.default");
        InteractiveRequestParameters parameters =
                InteractiveRequestParameters.builder(URI.create("http://localhost:8080/"))
                        .scopes(new HashSet<>(scopes))
                        .prompt(Prompt.SELECT_ACCOUNT)
                        .build();

        String accessToken = publicClientApplication.acquireToken(parameters).get().accessToken();

Expected behavior
For my Java application to be able to use the default/any browser to construct a usable PublicClientApplication so that I can interactively authenticate.

Setup (please complete the following information):

  • OS: OSX Big Sur
  • msal4j:1.11.0

Referencing original issue: Azure/azure-sdk-for-java#21166

Metadata

Metadata

Labels

AzureSDKIssues and requests affecting the Azure SDKBugSomething isn't working, needs an investigation and a fixP2Normal priority items, should be done after P1public-clientFor questions/issues related to public client apps

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions