Пример #1
0
        static void auth_OnResponseReceivedEvent(Token token, string state, string error)
        {
            //stop the http server
            auth.StopHttpServer();

            if (error != null)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error: " + error);
                return;
            }
            DisplayMenu(new SpotifyWebAPIClass()
            {
                AccessToken = token.AccessToken,
                TokenType   = token.TokenType,
                UseAuth     = true
            });
        }
Пример #2
0
        void _auth_OnResponseReceivedEvent(Token token, string state)
        {
            _auth.StopHttpServer();

            if (state != "XSS")
            {
                MessageBox.Show("Wrong state received.", "SpotifyWeb API Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (token.Error != null)
            {
                MessageBox.Show("Error: " + token.Error, "SpotifyWeb API Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            _spotify = new SpotifyWebAPI
            {
                UseAuth     = true,
                AccessToken = token.AccessToken,
                TokenType   = token.TokenType
            };
            InitialSetup();
        }