Skip to content

Commit

Permalink
Add more troubleshooting for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
bgavrilMS committed May 13, 2019
1 parent c1b0078 commit 0c2b977
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<!--<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworkMac)</TargetFrameworks>-->
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworkNetDesktop);$(TargetFrameworkNetStandard);$(TargetFrameworkNetCore);$(TargetFrameworkUap);$(TargetFrameworkIos);$(TargetFrameworkAndroid);$(TargetFrameworkMac)</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('OSX'))">$(TargetFrameworkNetStandard);$(TargetFrameworkNetCore);$(TargetFrameworkIos);$(TargetFrameworkAndroid);$(TargetFrameworkMac)</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworkNetStandard);$(TargetFrameworkNetCore);</TargetFrameworks>
</PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Linux')) Or '$(NetCoreOnly)' !='' ">$(TargetFrameworkNetStandard);$(TargetFrameworkNetCore);</TargetFrameworks> </PropertyGroup>

<PropertyGroup>
<!-- The MSAL.snk has both private and public keys -->
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.Identity.Client/MsalError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,11 @@ public static class MsalError
/// </summary>
public const string LoopbackResponseUriMisatch = "loopback_response_uri_mismatch";

/// <summary>
/// To use the default OS browser on Linux, make sure you can open a page using xdg-open tool. See https://aka.ms/msal-net-os-browser for details.
/// </summary>
public const string LinuxXdgOpen = "linux_xdg_open_failed";


#if iOS
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,18 @@ public override Task StartDefaultOsBrowserAsync(string url)
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
try
{
Process.Start("xdg-open", url);
}
catch (Exception ex)
{
throw new MsalClientException(
MsalError.LinuxXdgOpen,
"Unable to open a web page using xdg-open. See inner exception for details. Possible causes for this error are: xdg-open is not installed or " +
"it cannot find a way to open an url - make sure you can open a web page by invoking from a terminal: xdg-open https://www.bing.com ",
ex);
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Expand Down
1 change: 0 additions & 1 deletion tests/devapps/NetCoreTestApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class Program
private static readonly string s_clientIdForConfidentialApp = "<enter id>";

private static readonly string s_username = ""; // used for WIA and U/P, cannot be empty on .net core
private static readonly string s_authority = "https://login.microsoftonline.com/organizations/v2.0"; // common will not work for WIA and U/P but it is a good test case
private static readonly IEnumerable<string> s_scopes = new[] { "user.read" }; // used for WIA and U/P, can be empty

private const string GraphAPIEndpoint = "https://graph.microsoft.com/v1.0/me";
Expand Down

0 comments on commit 0c2b977

Please sign in to comment.