Skip to content

Commit

Permalink
Fix PromptCodeRecevier on .NET Core (#814)
Browse files Browse the repository at this point in the history
In .NET Core prompt the user to browse to the authentication URL, rather than launch a browser. Opening a URL as a process is not supported on Core. Fixes #813
  • Loading branch information
chrisdunelm authored Aug 15, 2016
1 parent 8a6af0f commit 4347b20
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion Src/Support/GoogleApis.Auth.NetStandard/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"System.Collections": "4.0.11",
"System.Console": "4.0.0",
"System.Diagnostics.Debug": "4.0.11",
"System.Diagnostics.Process": "4.1.0",
"System.IO": "4.1.0",
"System.IO.FileSystem": "4.0.1",
"System.IO.FileSystem.Primitives": "4.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
*/

using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;

Expand All @@ -40,8 +39,15 @@ public Task<AuthorizationCodeResponseUrl> ReceiveCodeAsync(AuthorizationCodeRequ
{
var authorizationUrl = url.Build().ToString();

#if NETSTANDARD
Logger.Debug("Requested user open a browser with \"{0}\" URL", authorizationUrl);
Console.WriteLine("Please visit the following URL in a web browser, then enter the code shown after authorization:");
Console.WriteLine(authorizationUrl);
Console.WriteLine();
#else
Logger.Debug("Open a browser with \"{0}\" URL", authorizationUrl);
Process.Start(authorizationUrl);
System.Diagnostics.Process.Start(authorizationUrl);
#endif

string code = string.Empty;
while (string.IsNullOrEmpty(code))
Expand Down
1 change: 0 additions & 1 deletion Src/Support/GoogleApis.Auth/Google.Apis.Auth.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
<dependency id="System.Collections" version="4.0.11" />
<dependency id="System.Console" version="4.0.0" />
<dependency id="System.Diagnostics.Debug" version="4.0.11" />
<dependency id="System.Diagnostics.Process" version="4.1.0" />
<dependency id="System.IO" version="4.1.0" />
<dependency id="System.IO.FileSystem" version="4.0.1" />
<dependency id="System.IO.FileSystem.Primitives" version="4.0.1" />
Expand Down
1 change: 0 additions & 1 deletion Src/Support/GoogleApis.Auth_dotnetcore/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"System.Collections": "4.0.11",
"System.Console": "4.0.0",
"System.Diagnostics.Debug": "4.0.11",
"System.Diagnostics.Process": "4.1.0",
"System.IO": "4.1.0",
"System.IO.FileSystem": "4.0.1",
"System.IO.FileSystem.Primitives": "4.0.1",
Expand Down

0 comments on commit 4347b20

Please sign in to comment.