66using Unosquare . Labs . EmbedIO ;
77using Unosquare . Labs . EmbedIO . Constants ;
88using 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
1017namespace 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