Skip to content

Commit a302694

Browse files
committed
Cleanup
1 parent 2f8bf68 commit a302694

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

SpotifyAPI.Web.Auth/AuthorizationCodeAuth.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ public Task<bool> GetEmpty(WebServer server, HttpListenerContext context)
9595
Error = error
9696
}));
9797

98-
#if NETSTANDARD2_0
99-
return context.StringResponseAsync("OK - This window can be closed now");
100-
#else
10198
return context.StringResponseAsync("OK - This window can be closed now");
102-
#endif
10399
}
104100

105101
[WebApiHandler(HttpVerbs.Post, "/")]

SpotifyAPI.Web.Auth/ImplictGrantAuth.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
using Unosquare.Labs.EmbedIO;
77
using Unosquare.Labs.EmbedIO.Constants;
88
using Unosquare.Labs.EmbedIO.Modules;
9+
#if NETSTANDARD2_0
10+
using System.Net.Http;
11+
#endif
12+
#if NET46
13+
using System.Net.Http;
14+
using HttpListenerContext = Unosquare.Net.HttpListenerContext;
15+
#endif
916

1017
namespace SpotifyAPI.Web.Auth
1118
{
@@ -27,14 +34,14 @@ protected override WebServer AdaptWebServer(WebServer webServer)
2734

2835
public class ImplictGrantAuthController : WebApiController
2936
{
30-
[WebApiHandler(HttpVerbs.Get, "/authe")]
31-
public bool GetAuth(WebServer server, HttpListenerContext context)
37+
[WebApiHandler(HttpVerbs.Get, "/auth")]
38+
public Task<bool> GetAuth(WebServer server, HttpListenerContext context)
3239
{
3340
string state = context.Request.QueryString["state"];
3441
SpotifyAuthServer<Token> auth = ImplictGrantAuth.GetByState(state);
3542
if (auth == null)
36-
return true; /*context.StringResponseAsync(
37-
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");*/
43+
return context.StringResponseAsync(
44+
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");
3845

3946
Token token;
4047
string error = context.Request.QueryString["error"];
@@ -58,9 +65,8 @@ public bool GetAuth(WebServer server, HttpListenerContext context)
5865
};
5966
}
6067

61-
Task.Factory.StartNew(() => auth?.TriggerAuth(token));
62-
return true;
63-
// return context.StringResponseAsync("OK - This window can be closed now");
68+
Task.Factory.StartNew(() => auth.TriggerAuth(token));
69+
return context.StringResponseAsync("OK - This window can be closed now");
6470
}
6571
}
6672
}

0 commit comments

Comments
 (0)