Azure / Azure/azure-libraries-for-java

[BUG Bash] Azure client authenticated with InteractiveBrowserCredential keep running after main method

Open
#1,221 0 comments 0 reactions 0 assignees View on GitHub
Mgmt v2
Dominant language
Java
Stars
97
Forks
102
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Codes with Azure client authenticated with `InteractiveBrowserCredential` keep running after main method done.

**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()
.port(8081)
.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**
Program should exit automatically after main method done.

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

**Additional context**
Besides, is there any method to set the redirect page content after user authenticated in browser? For now it's an empty page without auto close.

**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.