0

callback url, problem whit redirect format url

Hi everibody, I need your help
In my application I need to access delicious for retrieve user bookmarks. I follow this guide: http://delicious.com/help/oauthapi
In particular, after the step 3 (Get user permission to access their data) I would that the Yahoo! Autorization page redirect to my url http://127.0.0.1:28276/ConfirmPage.aspx.

I set oauth_callback="http://127.0.0.1:28276/ConfirmPage.aspx" but it does'nt work because when I click "continue" in Yahoo! Autorization page ,
the redirect url is trasformed in http://%22http//127.0.0.1:28276/ConfirmPage.aspx%22?oauth_token=...

I also tried to set oauth_callback="http://www.example_site.it", but the return url is always
http://%22http//www.example_site.it%22?oauth_token=...

I don't understand why the url start as http://%22http//

thanks for your help!

by
4 Replies
  • What is the exact query string you passed to the get_request_token call?

    It looks like you may have included some double quotes around your url when you should not have.

    Also note that your query parameters, including the callback, should have been url encoded in the call to get_request_token. Thus
    oauth_callback=http://foo/bar
    becomes
    oauth_callback=http%3A%2F%2Ffoo%2Fbar

    Take a look at this tutorial I wrote recently on OAuth: http://nullinfo.wordpress.com/oauth-yahoo/
    0
  • Hi, my query is
    https://api.login.yahoo.com/oauth/v2/get_re...17b42b3%26&oauth_callback="http://localhost:28276/ConfirmPage.aspx"


    After entering the data on the page of Yahoo! Authorization page, the redirect fails because the redirect url becomes as http://%22http//....

    To submit request token, I use this code in .NET


    public List<QueryParameter> getRequestToken(){

    string nonce = GenerateNonce();
    string timeStamp = GenerateTimeStamp();
    StringBuilder sb = new StringBuilder(this.requestTokenURL);
    sb.AppendFormat("?oauth_consumer_key={0}&", consumerKey);
    sb.AppendFormat("oauth_nonce={0}&", nonce);
    sb.AppendFormat("oauth_timestamp={0}&", timeStamp);
    sb.AppendFormat("oauth_signature_method={0}&", OAuthBase.SignatureTypes.PLAINTEXT);
    sb.AppendFormat("oauth_version={0}&", "1.0");
    sb.AppendFormat("oauth_signature={0}", consumerSecret);
    sb.AppendFormat("&oauth_callback=\"{0}\"", callback);

    WebClient client= new WebClient();
    byte[] tmp=client.DownloadData(new Uri(sb.ToString()));
    string result = System.Text.Encoding.GetEncoding("utf-8").GetString(tmp);
    //System.Diagnostics.Debug.WriteLine(sb.ToString());
    //System.Diagnostics.Debug.WriteLine(result);
    return QueryParameter.GetQueryParameters(result);
    }
    0
  • if you look at http://developer.yahoo.com/oauth/guide/oau...questtoken.html, there are a double quote around callback url.

    The method that I wrote make a request as https://api.login.yahoo.com/oauth/v2/get_re...Page.aspx"

    It returns a correct oauth_token.

    If I change sb.AppendFormat("&oauth_callback=\"{0}\"", callback); in sb.AppendFormat("&oauth_callback={0}", callback); I have an error 401

    Thanks for your help
    0
  • QUOTE (prisco.napoli @ Feb 20 2010, 12:44 AM) <{POST_SNAPBACK}>
    if you look at http://developer.yahoo.com/oauth/guide/oau...questtoken.html, there are a double quote around callback url.

    The method that I wrote make a request as https://api.login.yahoo.com/oauth/v2/get_re...Page.aspx"

    It returns a correct oauth_token.

    If I change sb.AppendFormat("&oauth_callback=\"{0}\"", callback); in sb.AppendFormat("&oauth_callback={0}", callback); I have an error 401

    Thanks for your help


    This is what I pass to the server cut-and-pasted from the output of getreqtok.php from my oauth-yahoo tutorial and this works.
    CODE
    https://api.login.yahoo.com/oauth/v2/get_request_token?oauth_callback=http%3A%2F%2Fexample.net%2Fcontact_test&oauth_consumer_key=blah--&oauth_nonce=1085309446&oauth_signature=324908498ead83923041%26&oauth_signature_method=PLAINTEXT&oauth_timestamp=1267044857&oauth_version=1.0

    Note the encoding of the oauth_callback url.
    After you authenticate to yahoo and authorize the app, it redirects to http://example.net/contact_test with the oauth_verifier in the query_parameter.
    0

Recent Posts

in OAuth General Discussion YDN SDKs