public async Task GetAuth()
        {
            string state = Request.QueryString["state"];
            SpotifyAuthServer <AuthorizationCodeResponse> auth = TokenSwapAuth.GetByState(state);

            string code  = null;
            string error = Request.QueryString["error"];

            if (error == null)
            {
                code = Request.QueryString["code"];
            }

            AuthorizationCodeResponse authcode = new AuthorizationCodeResponse
            {
                Code  = code,
                Error = error
            };

            TokenSwapAuth au = (TokenSwapAuth)auth;

            auth?.TriggerAuth(await au.ExchangeCodeAsync(authcode.Code));

            await HttpContext.SendStandardHtmlAsync(200, (tw) =>
            {
                tw.WriteLine(au.HtmlResponse);
                tw.Flush();
            });
        }
        public Task GetAuth()
        {
            string state = Request.QueryString["state"];
            SpotifyAuthServer <Token> auth = ImplicitGrantAuth.GetByState(state);

            if (auth == null)
            {
                return(HttpContext.SendStandardHtmlAsync(500, (tw) =>
                {
                    tw.WriteLine($"Failed - Unable to find auth request with state \"{state}\" - Please retry");
                    tw.Flush();
                }));
            }

            Token  token;
            string error = Request.QueryString["error"];

            if (error == null)
            {
                string accessToken = Request.QueryString["access_token"];
                string tokenType   = Request.QueryString["token_type"];
                string expiresIn   = Request.QueryString["expires_in"];
                token = new Token
                {
                    AccessToken = accessToken,
                    ExpiresIn   = double.Parse(expiresIn),
                    TokenType   = tokenType
                };
            }
            else
            {
                token = new Token
                {
                    Error = error
                };
            }

            Task.Factory.StartNew(() => auth.TriggerAuth(token));
            return(HttpContext.SendStandardHtmlAsync(200, (tw) =>
            {
                tw.WriteLine("<script>window.close()</script>");
                tw.Flush();
            }));
        }