Пример #1
0
        protected void obtainAuthorizationButton_Click(object sender, EventArgs e)
        {
            var    yammer = YammerConsumer.CreateConsumer(this.TokenManager);
            string requestToken;
            Uri    popupWindowLocation = YammerConsumer.PrepareRequestAuthorization(yammer, out requestToken);

            this.RequestToken = requestToken;
            string javascript = "window.open('" + popupWindowLocation.AbsoluteUri + "');";

            this.Page.ClientScript.RegisterStartupScript(GetType(), "YammerPopup", javascript, true);
            this.MultiView1.SetActiveView(this.CompleteAuthorizationView);
        }
Пример #2
0
        protected void finishAuthorizationButton_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            var yammer = YammerConsumer.CreateConsumer(this.TokenManager);
            var authorizationResponse = YammerConsumer.CompleteAuthorization(yammer, this.RequestToken, this.yammerUserCode.Text);

            if (authorizationResponse != null)
            {
                this.accessTokenLabel.Text = HttpUtility.HtmlEncode(authorizationResponse.AccessToken);
                this.MultiView1.SetActiveView(this.AuthorizationCompleteView);
            }
            else
            {
                this.MultiView1.SetActiveView(this.BeginAuthorizationView);
                this.authorizationErrorLabel.Visible = true;
            }
        }