-
Notifications
You must be signed in to change notification settings - Fork 24
fix: device code fallback for macOS browser auth and cross-platform URL opening #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sellakumaran
merged 19 commits into
main
from
fix/macos-browser-auth-msal-credential-fallback
Mar 6, 2026
Merged
Changes from 5 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
cbdfdba
fix: device code fallback for macOS browser auth and cross-platform U…
sellakumaran 6c8fe1d
fix: address PR review comments and handle Linux xdg_open_failed error
sellakumaran 4da9b55
fix: auto-fix public client flows, add requirements check to blueprin…
sellakumaran 3272376
fix: eliminate double auth on Linux, improve PS module error handling
sellakumaran 2eae60e
fix: add system requirement checks to all setup commands that use Gra…
sellakumaran 35bd6a0
Skip requirements on dry run; clarify browser fallback
sellakumaran f10f636
fix: skip requirements on dry run, self-correct missing PS modules in…
sellakumaran 1550c0e
fix: extract real JWT from Graph request headers; unify PS auth scope…
sellakumaran bae2765
fix: extract last stdout line as JWT token; add clean error for missi…
sellakumaran 5b58ab7
fix: unify PS token cache key in RemoveStale and DeployCommand; updat…
sellakumaran ed2ace6
fix: improve auth prompt UX and clarify custom permissions message
sellakumaran 4fd11c7
fix: retry blueprint SP lookup on Azure AD propagation delay
sellakumaran ba0e867
fix: fix admin consent polling via MSAL token with Application.Read.All
sellakumaran c1e2486
fix: fall back to MSAL when PS Connect-MgGraph fails on any platform
sellakumaran ac390bf
fix: address PR review comments - disposal, logging, exit handling, d…
sellakumaran 538f309
Merge with main.
sellakumaran 1867f3a
fix: address second round of PR review comments
sellakumaran 64b8c2d
chore: add CHANGELOG, NuGet release notes, and review process updates
sellakumaran cccd810
fix: address PR review comments - StringComparison, PSGallery, encodi…
sellakumaran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/Microsoft.Agents.A365.DevTools.Cli/Helpers/BrowserHelper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Diagnostics; | ||
| using System.Runtime.InteropServices; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Helpers; | ||
|
|
||
| /// <summary> | ||
| /// Helper methods for cross-platform browser and URL operations. | ||
| /// </summary> | ||
| public static class BrowserHelper | ||
| { | ||
| /// <summary> | ||
| /// Opens a URL in the system's default browser in a cross-platform way. | ||
| /// Non-fatal: logs a warning and prints the URL if the browser cannot be launched. | ||
| /// </summary> | ||
| /// <param name="url">The URL to open.</param> | ||
| /// <param name="logger">Optional logger for diagnostic messages.</param> | ||
| public static void TryOpenUrl(string url, ILogger? logger = null) | ||
| { | ||
|
sellakumaran marked this conversation as resolved.
|
||
| try | ||
| { | ||
| ProcessStartInfo psi; | ||
| if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
| { | ||
| psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; | ||
| } | ||
| else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
| { | ||
| psi = new ProcessStartInfo { FileName = "open", Arguments = url }; | ||
| } | ||
| else | ||
| { | ||
| psi = new ProcessStartInfo { FileName = "xdg-open", Arguments = url }; | ||
| } | ||
| using var process = new Process { StartInfo = psi }; | ||
| process.Start(); | ||
|
sellakumaran marked this conversation as resolved.
|
||
| } | ||
| catch (Exception ex) | ||
| { | ||
| if (logger != null) | ||
| { | ||
| logger.LogWarning("Failed to open browser automatically: {Message}", ex.Message); | ||
|
sellakumaran marked this conversation as resolved.
Outdated
|
||
| logger.LogInformation("Please manually open: {Url}", url); | ||
| } | ||
| else | ||
| { | ||
| Console.Error.WriteLine($"Failed to open browser automatically: {ex.Message}"); | ||
| Console.Error.WriteLine($"Please manually open: {url}"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.