【发布时间】:2023-04-05 05:40:01
【问题描述】:
我正在使用 oAuth 为谷歌的“纬度”范围获取未注册安装应用程序的请求令牌,我得到的响应字符串为
签名无效 base_string:GET&HTTPS%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetRequestToken&oauth_consumer_key%3Danonymous%26oauth_nonce%3D1D759072-DB2B-4E21-AA23-67CADF98C14A%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1306734462%26oauth_version%3D1.0%26scope% 3Dhttps%253A%252F%252Fwww.googleapis.com%252Fauth%252Flatitude%26xoauth_displayname%3DTaj%2520Vivanta我用来获取请求令牌的代码如下
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:@"anonymous" secret:@"anonymous"]; OAMutableURLRequest *request = [[[OAMutableURLRequest alloc] initWithURL:url consumer: consumer token:token realm:nil signatureProvider: nil] autorelease]; 如果(!请求)返回; [请求 setOAuthParameterName:@"scope" withValue:[@"https://www.googleapis.com/auth/latitude" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; [请求 setOAuthParameterName:@"xoauth_displayname" withValue:@"Taj Vivanta"]; [请求 setHTTPMethod:@"GET"]; OADataFetcher *fetcher = [[[OADataFetcher alloc] init] autorelease]; [fetcher fetchDataWithRequest:请求委托:self didFinishSelector:成功 didFailSelector:失败];请帮我解决这个问题,谢谢
【问题讨论】: