0

Trying to test my new service

Hey guys,

I am new to the API but I believe I have my OAuth all setup and working. I keep getting a "Please provide valid credentials. OAuth oauth_problem=\"token_rejected\"

when I try and query the API after authenticating. Can I test with /league/223.l.431/teams?

.NET Setup

Thanks, Arra

by
5 Replies
  • QUOTE (arra.derderian @ Apr 27 2011, 06:38 AM) <{POST_SNAPBACK}>
    Hey guys,

    I am new to the API but I believe I have my OAuth all setup and working. I keep getting a "Please provide valid credentials. OAuth oauth_problem=\"token_rejected\"

    when I try and query the API after authenticating. Can I test with /league/223.l.431/teams?

    .NET Setup

    Thanks, Arra


    To clarify guys,

    Here is the error I am getting when I make the API call.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><yahoo:error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:uri="http://yahoo.com" xml:lang="en-US"><yahoo:description>Please provide valid credentials. OAuth oauth_problem=&quot;OST_OAUTH_TOKEN_REJECTED_ERROR&quot;, realm=&quot;yahooapis.com&quot;</yahoo:description><yahoo:detail>Please provide valid credentials. OAuth oauth_problem=&quot;OST_OAUTH_TOKEN_REJECTED_ERROR&quot;, realm=&quot;yahooapis.com&quot;</yahoo:detail></yahoo:error>

    I am using Hammocks to make the call. I believe I did everything right prior. I even get an email from Yahoo! stating that I have confirmed my app to have access to my fantasy data. I created a test league under my login and when I test the query beloe in the YQL console it runs fine. Something must be wrong with my token or the process before this? I am not URLEncoding the token before setting it in Hammock as you can see. Any help would be great.

    RestClient client = new RestClient()
    {
    Authority = "https://query.yahooapis.com/v1",
    Credentials = new OAuthCredentials()
    {
    ConsumerKey = key,
    ConsumerSecret = secret,
    Token = oauth_token,
    TokenSecret = oauth_token_secret,
    SignatureMethod = OAuthSignatureMethod.HmacSha1,
    ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
    Type = OAuthType.ProtectedResource,
    Version = "1.0"
    }
    };

    var teamRequest = new RestRequest
    {
    Path = "/yql?q=select%20*%20from%20fantasysports.leagues%20where%20league_key%3D'253.l.224990'"
    };

    RestResponse rr = client.Request(teamRequest);
    0
  • Anyone out there!?
    0
  • QUOTE (Arra Derderian @ Apr 29 2011, 12:33 PM) <{POST_SNAPBACK}>
    Anyone out there!?


    If anyone can help with this it would be great. Is there a Yahoo representative I can speak with?
    0
  • QUOTE (Arra Derderian @ May 2 2011, 07:49 AM) <{POST_SNAPBACK}>
    If anyone can help with this it would be great. Is there a Yahoo representative I can speak with?


    I tried about 3 or 4 different tutorials to get OAuth to work. Even the code given in the YDN I couldn't get to work. It was a real pain. This one finally worked.
    http://nullinfo.wordpress.com/oauth-yahoo/

    hth
    Jim
    0
  • QUOTE (Arra Derderian @ May 2 2011, 07:49 AM) <{POST_SNAPBACK}>
    If anyone can help with this it would be great. Is there a Yahoo representative I can speak with?

    Very sorry that I didn't respond earlier. Definitely have a look at the link that Mr. Kenny Powers provided -- I've seen a couple other people recommend that one and it does certainly seem very thorough, at least if PHP is your language of choice. Regarding Hammocks, don't have any experience with it. The only part that strikes me is that you're trying to make just a single request for what needs to be an interactive flow, ie, it seems like you're doing 2-legged OAuth instead of 3-legged OAuth. I'd expect that, if you were doing 3-legged OAuth, you'd need to have:



    So, again, I'm not sure which parts of this Hammocks is supposed to abstract out, but it really seems like you're missing a few necessary steps because you need to be doing 3-legged OAuth.
    -2

Recent Posts

in Fantasy Sports API