コード例 #1
0
        public async Task Connect()
        {
            try
            {
                if (!HasInitialConfig())
                {
                    return;
                }

                ImplictGrantAuth auth = new ImplictGrantAuth(
                    _botConfig.SpotifyClientId,
                    _botConfig.SpotifyRedirectUri,
                    _botConfig.SpotifyServerUri,
                    Scope.UserReadCurrentlyPlaying
                    | Scope.UserReadPlaybackState
                    | Scope.UserModifyPlaybackState);

                auth.AuthReceived += OnAuthReceived;
                auth.Start();
                auth.OpenBrowser();
            }
            catch (Exception ex)
            {
                await _errHndlrInstance.LogError(ex, "TwitchBotApplication", "Connect()", false);
            }
        }
コード例 #2
0
        private static void AuthorizeUser()
        {
            ImplictGrantAuth auth =
                new ImplictGrantAuth(Settings.ClientID, "http://localhost:4002", "http://localhost:4002", Scope.UserReadRecentlyPlayed | Scope.PlaylistModifyPrivate | Scope.PlaylistReadPrivate | Scope.PlaylistModifyPublic);

            auth.AuthReceived += OnAuthReceived;
            auth.Start();
            auth.OpenBrowser();
            Thread.Sleep(-1);
        }