示例#1
0
        internal static XmlDocument GetResultXml(OAuthDelicious oAuth, string apiRelativeUrl)
        {
            XmlDocument xmlDoc = null;
            try
            {
                xmlDoc = new System.Xml.XmlDocument();
                xmlDoc.LoadXml(oAuth.APIWebRequest(OAuthDelicious.Method.GET.ToString(), apiRelativeUrl, null));
            }
            catch (XmlException)
            {
                throw new Exceptions.DeliciousException ("The webserver did not return valid XML.");
            }

            return xmlDoc;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //System.Diagnostics.Debugger.Break();

        gridPosts.Visible = false;

        if (Session["AuthorizedState"] != null)
        {
            //load object from session
            delOAuth = Session["AuthorizedState"] as OAuthDelicious;
        }

        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["oauth_token"])
                && !string.IsNullOrEmpty(Request.QueryString["oauth_verifier"]))
            {
                try
                {
                    //get token and verifier from url
                    delOAuth.Token = Request.QueryString["oauth_token"];
                    delOAuth.Verifier = Request.QueryString["oauth_verifier"];

                    txtOutput.Text += "\nToken was authorized: " + delOAuth.Token + " with verifier: " + delOAuth.Verifier;

                    //get access token
                    String accessToken = delOAuth.getAccessToken();
                    txtOutput.Text += "\nAccess token was received: " + delOAuth.Token;

                    //save state to file for future api calls without passing through authorization step
                    delOAuth.SaveOAuthState();

                    //save state in session
                    Session["AuthorizedState"] = delOAuth;
                }
                catch (Exception exp)
                {
                    txtOutput.Text += "\nException: " + exp.Message;
                }
            }
        }
    }
示例#3
0
 public Post(OAuthDelicious oAuth)
 {
     _oAuth = oAuth;
 }
    private void InitializeOAuthObject()
    {
        delOAuth = new OAuthDelicious();

        //API/Consumer key obtained from YDN
        delOAuth.ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"];

        //API/Consumer secret obtained from YDN
        delOAuth.ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"];

        //set the call back url here.
        //yahoo will redirect you here after authorization
        //custom port is not allowed in callback url (eg http://localhost:8085/)
        delOAuth.CALLBACK_URL = Request.Url.Host;
    }
示例#5
0
 /// <summary>
 /// Construct a new <c>Tag</c>
 /// </summary>
 public Tag(OAuthDelicious oAuth)
 {
     _oAuth = oAuth;
 }
示例#6
0
 public Bundle(OAuthDelicious oAuth)
 {
     _oAuth = oAuth;
 }