Azure / Azure/azure-libraries-for-java

[BUG Bash] `InteractiveBrowserCredentialBuilder` uses 0 as the default port which will not work

Open
#1,219 3 comments 0 reactions 1 assignee Claimed by @weidongxu-microsoft View on GitHub
Mgmt v2 v2 GA
Dominant language
Java
Stars
97
Forks
102
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
`InteractiveBrowserCredentialBuilder` uses `0` as the default port, which we can't get Azure's response.

***Exception or Stack Trace***
```
This site can’t be reachedThe webpage at http://localhost:0/?code=CODE&session_state=SESSION might be temporarily down or it may have moved permanently to a new web address.
```

**To Reproduce**
Steps to reproduce the behavior:
Run codes in *Code Snippet*

***Code Snippet***
Add the code snippet that causes the issue.
``` java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
TokenCredential credential = new InteractiveBrowserCredentialBuilder()
.clientId("CLIENT_ID").build();
Azure azure = Azure
.authenticate(credential, profile)
.withSubscription("SUBSCRIPTION");
for (Subscription subscription : azure.subscriptions().list()) {
System.out.println(subscription.displayName());
}
```

**Expected behavior**
SDK use an valid port as the default value or throw exception that we must specify the port first

**Setup (please complete the following information):**
- JRE Version: [e.g. Open JDK 8] Oracle JDK 8
- SDK Version: 2.0.0-SNAPSHOT

**Additional context**
N/A

**Information Checklist**
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x] Bug Description Added
- [x] Repro Steps Added
- [x] Setup information Added

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.