6
6
using Unosquare . Labs . EmbedIO ;
7
7
using Unosquare . Labs . EmbedIO . Constants ;
8
8
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
9
16
10
17
namespace SpotifyAPI . Web . Auth
11
18
{
@@ -27,14 +34,14 @@ protected override WebServer AdaptWebServer(WebServer webServer)
27
34
28
35
public class ImplictGrantAuthController : WebApiController
29
36
{
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 )
32
39
{
33
40
string state = context . Request . QueryString [ "state" ] ;
34
41
SpotifyAuthServer < Token > auth = ImplictGrantAuth . GetByState ( state ) ;
35
42
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") ;
38
45
39
46
Token token ;
40
47
string error = context . Request . QueryString [ "error" ] ;
@@ -58,9 +65,8 @@ public bool GetAuth(WebServer server, HttpListenerContext context)
58
65
} ;
59
66
}
60
67
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" ) ;
64
70
}
65
71
}
66
72
}
0 commit comments