Tag: google data api

OAuthGetRequestToken:signature_invalid错误

我尝试使用谷歌数据API,并遇到困难在OAuthGetRequestToken。 我遵循指令: requestToken 我使用GET并在URL之后添加查询参数。 我以这种方式为签名创build基本string:按字母顺序sorting的GET&request url&query参数(不带oauth_signature) 在我使用HMAC-SHA1时,我使用“消费者机密”值来创build签名。 最后,我使用url +查询参数,浏览器总是返回:signature_invalid base_string:GET&https%3A%2 ****** 我发现base_string与我的代码中的一样。 我不知道问题在哪里,请求帮助。 下面是我的代码:(hmac_sha1是正确的,因为我使用Oauth的样本数据来testing) #import "ContactTestViewController.h" #import "ASIHTTPRequest.h" #import <CommonCrypto/CommonHMAC.h> #import <CommonCrypto/CommonCryptor.h> #import "Base64.h" #import "NSStringAdditions.h" #import "NSData+Base64.h" #define kAllContacts @"https://www.google.com/m8/feeds/contacts/default/full" #define kOauthGetRequestToken @"https://www.google.com/accounts/OAuthGetRequestToken" #define kOauthConsumerKey @"oauth_consumer_key=***.net" #define kOauthConsumerSecret @"****/*****" #define kOauthNonce @"oauth_nonce=457261624861626265724761686176" #define kOauthSigMethod @"oauth_signature_method=HMAC-SHA1" #define kOauthSignature @"oauth_signature=" #define kOauthTimeStamp @"oauth_timestamp=" #define kOauthScope @"scope=https://www.google.com/m8/feeds/contacts/default/full" […]