diff --git a/OAuthDesktopApp/OAuthDesktopApp/App.config b/OAuthDesktopApp/OAuthDesktopApp/App.config
index 00bfd11..dac8854 100755
--- a/OAuthDesktopApp/OAuthDesktopApp/App.config
+++ b/OAuthDesktopApp/OAuthDesktopApp/App.config
@@ -1,6 +1,14 @@
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OAuthDesktopApp/OAuthDesktopApp/MainWindow.xaml.cs b/OAuthDesktopApp/OAuthDesktopApp/MainWindow.xaml.cs
index 68c9138..12f006b 100755
--- a/OAuthDesktopApp/OAuthDesktopApp/MainWindow.xaml.cs
+++ b/OAuthDesktopApp/OAuthDesktopApp/MainWindow.xaml.cs
@@ -21,8 +21,8 @@
using System.Text;
using System.Windows;
using System.Security.Cryptography;
-using System.Threading;
using System.Threading.Tasks;
+using Microsoft.VisualStudio;
namespace OAuthApp
{
@@ -69,8 +69,22 @@ private async void button_Click(object sender, RoutedEventArgs e)
var http = new HttpListener();
http.Prefixes.Add(redirectURI);
output("Listening..");
- http.Start();
-
+
+ try
+ {
+ http.Start();
+ }
+ catch (HttpListenerException ex)
+ {
+ if (ex.HResult == VSConstants.E_FAIL)
+ {
+ MessageBox.Show("Access denied. Try running the program as an administrator.", "OAuthDesktopApp",
+ MessageBoxButton.OK, MessageBoxImage.Warning);
+
+ return;
+ }
+ }
+
// Creates the OAuth 2.0 authorization request.
string authorizationRequest = string.Format("{0}?response_type=code&scope=openid%20profile&redirect_uri={1}&client_id={2}&state={3}&code_challenge={4}&code_challenge_method={5}",
authorizationEndpoint,
diff --git a/OAuthDesktopApp/OAuthDesktopApp/OAuthDesktopApp.csproj b/OAuthDesktopApp/OAuthDesktopApp/OAuthDesktopApp.csproj
index 360c655..651fd6e 100755
--- a/OAuthDesktopApp/OAuthDesktopApp/OAuthDesktopApp.csproj
+++ b/OAuthDesktopApp/OAuthDesktopApp/OAuthDesktopApp.csproj
@@ -35,6 +35,51 @@
4
+
+ ..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll
+
+
+ ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll
+
+
+ ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll
+
..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll
True
diff --git a/OAuthDesktopApp/OAuthDesktopApp/packages.config b/OAuthDesktopApp/OAuthDesktopApp/packages.config
index adc92ba..c51fd53 100755
--- a/OAuthDesktopApp/OAuthDesktopApp/packages.config
+++ b/OAuthDesktopApp/OAuthDesktopApp/packages.config
@@ -1,4 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file