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
|
Error = error
|
||||||
}));
|
}));
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
return context.StringResponseAsync("OK - This window can be closed now");
|
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, "/")]
|
[WebApiHandler(HttpVerbs.Post, "/")]
|
||||||
|
@ -6,6 +6,13 @@ using SpotifyAPI.Web.Models;
|
|||||||
using Unosquare.Labs.EmbedIO;
|
using Unosquare.Labs.EmbedIO;
|
||||||
using Unosquare.Labs.EmbedIO.Constants;
|
using Unosquare.Labs.EmbedIO.Constants;
|
||||||
using Unosquare.Labs.EmbedIO.Modules;
|
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
|
namespace SpotifyAPI.Web.Auth
|
||||||
{
|
{
|
||||||
@ -27,14 +34,14 @@ namespace SpotifyAPI.Web.Auth
|
|||||||
|
|
||||||
public class ImplictGrantAuthController : WebApiController
|
public class ImplictGrantAuthController : WebApiController
|
||||||
{
|
{
|
||||||
[WebApiHandler(HttpVerbs.Get, "/authe")]
|
[WebApiHandler(HttpVerbs.Get, "/auth")]
|
||||||
public bool GetAuth(WebServer server, HttpListenerContext context)
|
public Task<bool> GetAuth(WebServer server, HttpListenerContext context)
|
||||||
{
|
{
|
||||||
string state = context.Request.QueryString["state"];
|
string state = context.Request.QueryString["state"];
|
||||||
SpotifyAuthServer<Token> auth = ImplictGrantAuth.GetByState(state);
|
SpotifyAuthServer<Token> auth = ImplictGrantAuth.GetByState(state);
|
||||||
if (auth == null)
|
if (auth == null)
|
||||||
return true; /*context.StringResponseAsync(
|
return context.StringResponseAsync(
|
||||||
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");*/
|
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");
|
||||||
|
|
||||||
Token token;
|
Token token;
|
||||||
string error = context.Request.QueryString["error"];
|
string error = context.Request.QueryString["error"];
|
||||||
@ -58,9 +65,8 @@ namespace SpotifyAPI.Web.Auth
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.Factory.StartNew(() => auth?.TriggerAuth(token));
|
Task.Factory.StartNew(() => auth.TriggerAuth(token));
|
||||||
return true;
|
return context.StringResponseAsync("OK - This window can be closed now");
|
||||||
// return context.StringResponseAsync("OK - This window can be closed now");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user