0

consumer_key_rejected

Hello, im testing the "Yahoo! Social SDK for PHP" and got stuck on the auth part.

here is the code im using:

==========================================
<?php
require("lib/Yahoo.inc");
$GLOBAL_YAHOO_LOGGER_DEBUG = true;
$GLOBAL_YAHOO_LOGGER_DEBUG_DESTINATION = "CONSOLE";
define('CONSUMER_KEY', "dj0yJmk9T29NUGVvaUMxM0R1JmQ9WVdrOVdVa3hhamRsTkc4bWNHbzlOakkxT1RreU5qQXgmcz1
jb25zdW1lcnNlY3JldCZ4PTA2");
define('CONSUMER_SECRET', "e9809bbc5e06ebd25986301cc8ee3388a32e92a5");
define('APPID', "YI1j7e4o");
$session = YahooSession::requireSession(CONSUMER_KEY,CONSUMER_SECRET,APPID);
?>
==========================================

which outputs the following:

==========================================
DEBUG - HTTP request details
DEBUG OBJECT - Array
(
[method] => POST
[url] => https://api.login.yahoo.com/oauth/v2/get_request_token
[code] => 401
[requestHeaders] => Array
(
[0] => Accept: application/json
[1] => Content-Type: application/x-www-form-urlencoded
)

[requestBody] => oauth_callback=http%3A%2F%2F&oauth_consumer_key=dj0yJmk9T29
NUGVvaUMxM0R1JmQ9WVdrOVdVa3hhamRsTkc4bWNHbzlOakkxT1RreU5qQXgmcz1jb25zdW1lcnNlY3J
ldCZ4PTA2&oauth_nonce=c5793cc48ef18c2e32ebb498bb2bb063&oauth_signature=qu1IuVSYl
pRdfXrlO0BALo8ZJJM%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=125820049
0&oauth_version=1.0
[responseHeaders] => Array
(
[Date] => Sat, 14 Nov 2009 12:08:10 GMT
[P3P] => policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP
COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUB
i IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
[WWW-Authenticate] => OAuth oauth_problem=consumer_key_rejected
[Connection] => close
[Transfer-Encoding] => chunked
[Content-Type] => application/x-www-form-urlencoded
)

[responseBody] => oauth_problem=consumer_key_rejected
)

ERROR - Failed to create request token: consumer_key_rejected
ERROR - Failed to create request token
ERROR - Failed to create authorization URLs


==========================================

PLEASE HELP AS I TRIED EVERYTHING!

by
  • Mr
  • Nov 14, 2009
19 Replies
  • Can you confirm the consumer key and shared secret? Generally, this means the consumer key you specified was invalid.
    0
  • QUOTE (Dustin Whittle @ Nov 14 2009, 05:19 PM) <{POST_SNAPBACK}>
    Can you confirm the consumer key and shared secret? Generally, this means the consumer key you specified was invalid.


    What do you mean with "confirm the key". I generated various keys and same result.
    0
  • Yahoo support total crap as always...
    0
  • There is no need for the hostility mrbeefx. What Dustin was referring to was when you created your application you were given a series of keys. This error generally means there is a mismatch between the consumer key and secret keys you were given. Please check to make sure the consumer and secret keys that you are using from your application are correctly copied over.

    - Jon
    0
  • QUOTE (Jonathan LeBlanc @ Nov 30 2009, 01:14 PM) <{POST_SNAPBACK}>
    There is no need for the hostility mrbeefx. What Dustin was referring to was when you created your application you were given a series of keys. This error generally means there is a mismatch between the consumer key and secret keys you were given. Please check to make sure the consumer and secret keys that you are using from your application are correctly copied over.

    - Jon


    Sorry but im really frustrated since i seam to be the only one that has this problem. I have copied the exact strings no errors at all and i get the same result. I also deleted/generated several keys but still the same result :(Thank you!
    0
  • i have the same problem,too.anyone knows what's wrong?i copy the consumer key &secret ,but still got 'oauth_problem=consumer_key_rejected' error(401)
    0
  • try to delete the application and create a new project with "New Project" button at http://developer.apps.yahoo.com/dashboard/ then change you consumer key and consumer secret ... it works for me
    0
  • Hi Floyd,

    Can you please paste your consumer key here? We can check it from our side to see why it is invalid.

    Thanks,
    Yu Wang
    Yahoo! Membership

    QUOTE (floyd @ Jan 4 2010, 01:06 AM) <{POST_SNAPBACK}>
    i have the same problem,too.anyone knows what's wrong?i copy the consumer key &secret ,but still got 'oauth_problem=consumer_key_rejected' error(401)
    0
  • Hi guys.
    I have the same problem too.
    In waht way I can test my consumer key? Does have Yahoo! some console in which I could test or generate link with my credentials?

    I will wait for your answers...
    0
  • Hi Zwer,

    You can see all your consumer keys from your YDN projects page:
    https://developer.apps.yahoo.com/projects

    If you need to access user data such as Yahoo! Updates, Status and etc,
    then please make sure your consumer key belongs to the OAuth applications
    category.

    We don't have any console for you to test generation of credentials.
    I would suggest you start from the Yahoo! Updates API demo
    http://developer.yahoo.com/social/updates/demo.html

    Once you have that working, then you can start building your applications
    with the Yahoo! PHP SDK.

    Thanks,
    Yu Wang
    Yahoo! Membership
    0
  • I have the same problem...

    I made a simply auth script:
    and output: consumer_key_rejected


    I have try to rebuild the API Key and nothing...
    I have the same response...

    consumer_key_rejected

    ...

    nothing to do?


    This is the script
    CODE
    $urlBack="http://www.olo-service.com"; 
    $api_key="############################################################################
    ################################";
    $secret="########################################";
    $callback="http://www.olo-service.com";

    function getUniqueCode($length = "10") {
    $code = md5(uniqid(rand(), true));
    if ($length != "") return substr($code, 0, $length); else return $code; }
    $nonce = getUniqueCode();

    //Collect the neccesary variables and construct the API URL
    $url = "https://api.login.yahoo.com/oauth/v2/get_request_token?";
    $url.= "oauth_nonce=".$nonce;
    $url.= "&oauth_timestamp=".time();
    $url.= "&oauth_consumer_key=".$consumer_key;
    $url.= "&oauth_signature_method=plaintext";
    $url.= "&oauth_signature=".$secret."%26";
    $url.= "&oauth_version=1.0";
    $url.= "&xoauth_lang_pref=en-us";
    $url.= "&oauth_callback=".$callback;

    //Make the API Call to Yahoo!
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);

    echo "<p style=\"font-size:10px; color:blue;\">responses: ".$response."</p>";
    //$responses = explode("&", $response);
    0
  • Hi gabrielem,

    Can you please provide your consumer key here? We can check it from our side to see why it is invalid.

    Thanks,
    Yu Wang
    Yahoo! Membership
    0
  • Hi,
    I have the same problem too. I am using signpost java api.

    String customerKey = "dj0yJmk9dmNqbk5Sa2VRaExLJmQ9WVdrOVRGbHdWREZUTmpRbWNHbzlPVGcwT1RjNE56WXkmcz1
    jb25zdW1lcnNlY3JldCZ4PTcy";
    String customerSecret = "5bed10dce546572901d6b267383a98436825c1f0";
    OAuthConsumer consumer = new DefaultOAuthConsumer(customerKey, customerSecret);
    String request_token_url = "https://api.login.yahoo.com/oauth/v2/get_request_token";
    String auth_token_url = "https://api.login.yahoo.com/oauth/v2/request_auth";
    String access_token_url = "https://api.login.yahoo.com/oauth/v2/get_token";
    OAuthProvider provider = new DefaultOAuthProvider(request_token_url, auth_token_url,access_token_url);
    System.out.println("Fetching request token...");
    String authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
    0
  • Hi Yanping,

    This is the command I tried:

    wget -S -d 'https://api.login.yahoo.com/oauth/v2/get_request_token' --post-data='oauth_callback=oob&oauth_consumer_key=dj0yJmk9dmNqbk5Sa2VRaExLJmQ9WVdrOVRGbHdWREZUTmpRbWNHbzlPV
    GcwT1RjNE56WXkmcz1jb25zdW1lcnNlY3JldCZ4PTcy&oauth_nonce=nonce&oauth_signature=5bed10dce546572901d6b267383a98436825c1f0%26&oauth_signature_method=PLAINTEXT&oauth_timestamp=1271113563&oauth_version=1.0'

    It returns me this following in the response body:

    oauth_token=krf7zvx&oauth_token_secret=a1d0fdf7ba7e2dc155ae0d2685c86d731d624989&oauth_expires_in=3600&xoauth_requ
    est_auth_url=https%3A%2F%2Fapi.login.yahoo.com%2Foauth%2Fv2%2Frequest_auth%3Foauth_token%3Dkrf7zvx&oauth_callback
    _confirmed=true

    So your consumer key looks good. Can you please make sure that the call to the get_request_token
    is HTTP POST, not HTTP GET? The latter has a limit on the URL length.

    Thanks,
    Yu Wang
    Yahoo! Membership Team
    0
  • OK!
    My key is: dj0yJmk9cWlKbHhGdlI0a1lRJmQ9WVdrOVRtcHlRV1pLTm5VbWNHbzlNVGcxTVRVeE5qYzJNZy0tJnM9
    Y29uc3VtZXJzZWNyZXQmeD03Zg--

    TY!
    0
  • Hi Yu,
    Finally I found the problem is in signpost library. it doesn't have call back method in the http header. it is removed for Twitter.
    Once I uncomment the ccode, the response is 200. instead of 401.

    Thanks,

    The following is the code original in signpost:
    public class AuthorizationHeaderSigningStrategy implements SigningStrategy {

    private static final long serialVersionUID = 1L;

    @Override
    public String writeSignature(String signature, HttpRequest request,
    RequestParameters requestParameters) {
    StringBuilder sb = new StringBuilder();

    sb.append("OAuth ");
    if (requestParameters.containsKey("realm")) {
    sb.append(requestParameters.getAsHeaderElement("realm"));
    sb.append(", ");
    }
    if (requestParameters.containsKey(OAuth.OAUTH_TOKEN)) {
    sb.append(requestParameters.getAsHeaderElement(OAuth.OAUTH_TOKEN));
    sb.append(", ");
    }
    // Twitter sends 401 when oauth_callback is passed in the Authorization
    // header, so leave this blank for now
    // if (requestParameters.containsKey(OAuth.OAUTH_CALLBACK)) {
    // sb.append(requestParameters.getAsHeaderElement(OAuth.OAUTH_CALLBACK));
    // sb.append(", ");
    // }
    0
  • Hi Yanping,

    Thanks for the information. It is useful for other users of the
    signpost library when they code for Yahoo! OAuth.

    Thanks,
    Yu Wang
    0
  • Hi gabrielem,

    Your consumer key is registered as not requiring user authentication, so the
    get_request_token call is not applicable here. That's why it is rejected.

    If you need to access user data such as Yahoo! Updates, Status and etc,
    then please make sure your consumer key belongs to the OAuth applications
    category:
    https://developer.apps.yahoo.com/projects

    You'd need to register a new consumer key.

    Thanks,
    Yu Wang
    0
  • Hi all,

    I am closing this topic. In case you see consumer key rejected in the
    OAuth flow, please check your Projects list
    https://developer.apps.yahoo.com/projects
    and make sure that your consumer key belongs to the OAuth applications
    category.

    Thanks,
    Yu Wang
    0

Recent Posts

in OAuth General Discussion YDN SDKs