Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // The request token is stored in session - if it isn't present then we do nothing
            if (Request.QueryString["oauth_verifier"] != null && Session["RequestToken"] != null)
            {
                Flickr            f            = FlickrManager.GetInstance();
                OAuthRequestToken requestToken = Session["RequestToken"] as OAuthRequestToken;
                try
                {
                    OAuthAccessToken accessToken = f.OAuthGetAccessToken(requestToken,
                                                                         Request.QueryString["oauth_verifier"]);
                    FlickrManager.OAuthToken = accessToken;

                    ResultsLabel.Text    = "You successfully authenticated as " + accessToken.FullName;
                    ResultPanel.CssClass = "alert alert-success";
                    ResultPanel.Visible  = true;
                }
                catch (OAuthException ex)
                {
                    ResultsLabel.Text    = "An error occurred retrieving the token : " + ex.Message;
                    ResultPanel.CssClass = "alert alert-danger";
                    ResultPanel.Visible  = true;
                }
            }
        }
Ejemplo n.º 2
0
        public static List <Photo> GetPhotostream(string userId)
        {
            Flickr          f      = FlickrManager.GetAuthInstance();
            PhotoCollection photos = f.PeopleGetPublicPhotos(userId, 0, 12, SafetyLevel.None, PhotoSearchExtras.PathAlias);

            return(photos.ToList());
        }
Ejemplo n.º 3
0
        protected void AuthenticateButton_Click(object sender, EventArgs e)
        {
            Flickr            f     = FlickrManager.GetInstance();
            OAuthRequestToken token = f.OAuthGetRequestToken(Request.Url.AbsoluteUri);

            Session["RequestToken"] = token;

            string url = f.OAuthCalculateAuthorizationUrl(token.Token, AuthLevel.Read);

            Response.Redirect(url);
        }