示例#1
0
        private void LoginOnClick(object sender, EventArgs eventArgs)
        {
            AuthenticationRequest.Builder builder =
                new AuthenticationRequest.Builder(ClientId, AuthenticationResponse.Type.Token, RedirectUri);
            builder.SetScopes(new[] { Scopes });
            AuthenticationRequest request = builder.Build();

            AuthenticationClient.OpenLoginActivity(this, RequestCode, request);
        }
示例#2
0
        public void Login()
        {
            string[] scopes  = { "user-library-read", "user-read-private", "playlist-read", "playlist-read-private", "playlist-read-collaborative", "streaming" };
            var      request = new AuthenticationRequest.Builder(ApiConstants.SpotifyClientId, AuthenticationResponse.Type.Token, ApiConstants.SpotifyRedirectUri).SetScopes(scopes).Build();

            var activity = (Activity)Forms.Context as MainActivity;

            if (activity != null)
            {
                activity.ActivityResultDelegate += HandleActivityResultDelegate;
            }

            AuthenticationClient.OpenLoginActivity(activity, ApiConstants.SpotifyRequestCode, request);
        }
示例#3
0
        // == Authentication == //

        // scopes: https://developer.spotify.com/web-api/using-scopes/
        // TODO Combine scope usage?

        public void OpenLoginWindow()
        {
            var request = new AuthenticationRequest.Builder(sms.ClientId, AuthenticationResponse.Type.Token, sms.SpotifyCallback)
                          .SetScopes(new string[] {
                "streaming",
                "playlist-read-private",
                "playlist-read-collaborative",
                "user-library-read",
                "user-read-private",
                "user-read-email"
            })
                          .Build();

            AuthenticationClient.OpenLoginActivity(this.sms.mainActivity, REQUEST_CODE, request);
        }