Question

Le fait que délicieux a deux ensembles de l'API authentifications avec un nom d'utilisateur et mot de passe et une avec oAuth m'a dit quelque chose que j'allais faire l'expérience et je n'étais pas mal. Malheureusement, je dois traiter avec les deux API maintenant et ne réussis pas passer à travers le premier obstacle de l'API v2 (Yahoo oAuth).

Voici un extrait de code (j'utilise OpenSocial dans cet exemple http: / /code.google.com/p/opensocial-net-client)

public static string GetRequestToken(string callbackUrl)
{
    string normaluri;
    string normaluriparam;
    OAuthBase oAuth = new OAuthBase();
    string nonce = oAuth.GenerateNonce();
    string timeStamp = oAuth.GenerateTimeStamp();
    string sig = oAuth.GenerateSignature(new Uri(TOKEN_URL), ConfigurationManager.AppSettings[CONSUMER_KEY],
                                         ConfigurationManager.AppSettings[SECRET_KEY],
                                         string.Empty,
                                         string.Empty,
                                         "GET",
                                         timeStamp,
                                         nonce,
                                         OAuthBase.SignatureTypes.HMACSHA1,
                                         out normaluri,
                                         out normaluriparam);
    sig = HttpUtility.UrlEncode(sig);

    string result =
        HttpClient.Get(TOKEN_URL, new
                                      {
                                          oauth_nonce = nonce,
                                          oauth_timestamp = timeStamp,
                                          oauth_consumer_key = ConfigurationManager.AppSettings[CONSUMER_KEY],
                                          oauth_signature_method = "HMAC-SHA1",
                                          oauth_signature = sig,
                                          oauth_version = "1.0",
                                          oauth_callback = callbackUrl
                                      });

    return result;
}

Il semble peu importe si je suivre les instructions http://delicious.com/help/oauthapi moi-même de laisser à OpenSocial, je reçois un « 401 Unauthorized » à partir du serveur sans plus d'information.

Je vois beaucoup de gens ont le même problème, mais n'a pas pu trouver une résolution.

Était-ce utile?

La solution

La réponse est « ne pas utiliser HMAC-SHA1 pour cette étape. Aussi j'oublié d'inclure callbackUrl dans ma signature.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top