mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Cleanup
This commit is contained in:
parent
2f8bf6877f
commit
a302694da8
@ -95,11 +95,7 @@ namespace SpotifyAPI.Web.Auth
|
||||
Error = error
|
||||
}));
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
return context.StringResponseAsync("OK - This window can be closed now");
|
||||
#else
|
||||
return context.StringResponseAsync("OK - This window can be closed now");
|
||||
#endif
|
||||
}
|
||||
|
||||
[WebApiHandler(HttpVerbs.Post, "/")]
|
||||
|
@ -6,6 +6,13 @@ using SpotifyAPI.Web.Models;
|
||||
using Unosquare.Labs.EmbedIO;
|
||||
using Unosquare.Labs.EmbedIO.Constants;
|
||||
using Unosquare.Labs.EmbedIO.Modules;
|
||||
#if NETSTANDARD2_0
|
||||
using System.Net.Http;
|
||||
#endif
|
||||
#if NET46
|
||||
using System.Net.Http;
|
||||
using HttpListenerContext = Unosquare.Net.HttpListenerContext;
|
||||
#endif
|
||||
|
||||
namespace SpotifyAPI.Web.Auth
|
||||
{
|
||||
@ -27,14 +34,14 @@ namespace SpotifyAPI.Web.Auth
|
||||
|
||||
public class ImplictGrantAuthController : WebApiController
|
||||
{
|
||||
[WebApiHandler(HttpVerbs.Get, "/authe")]
|
||||
public bool GetAuth(WebServer server, HttpListenerContext context)
|
||||
[WebApiHandler(HttpVerbs.Get, "/auth")]
|
||||
public Task<bool> GetAuth(WebServer server, HttpListenerContext context)
|
||||
{
|
||||
string state = context.Request.QueryString["state"];
|
||||
SpotifyAuthServer<Token> auth = ImplictGrantAuth.GetByState(state);
|
||||
if (auth == null)
|
||||
return true; /*context.StringResponseAsync(
|
||||
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");*/
|
||||
return context.StringResponseAsync(
|
||||
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");
|
||||
|
||||
Token token;
|
||||
string error = context.Request.QueryString["error"];
|
||||
@ -58,9 +65,8 @@ namespace SpotifyAPI.Web.Auth
|
||||
};
|
||||
}
|
||||
|
||||
Task.Factory.StartNew(() => auth?.TriggerAuth(token));
|
||||
return true;
|
||||
// return context.StringResponseAsync("OK - This window can be closed now");
|
||||
Task.Factory.StartNew(() => auth.TriggerAuth(token));
|
||||
return context.StringResponseAsync("OK - This window can be closed now");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user