签名与期望值oAuth Tumblr请求不符

你好朋友,我正在使用oauth与tumblr进行登录

我的问题是我在oauth的第一步中遇到了这个错误

oauth_signature与预期值不符

我正在使用oauth 1.0库

这是我的第一部分代码

  • (void)viewDidLoad {[super viewDidLoad];

    clientID = @“zKJI0u2qC4u9fZzSzDNit289fjYy7zytDevTD0zv1QWzxqSUcb”; secret = @“P0cJxrFiSPAMHMsLIPTQQf7nGQDDCpDpAP9syWeRhcDrresoyW”;

    redirect = @“http://codegerms.com/”;

    [self connectTumblr];

  • }

    - (void)connectTumblr {

    consumer = [[OAConsumer alloc]initWithKey:clientID secret:nil];
    
    
    NSURL* requestTokenUrl = [NSURL URLWithString:@"http://www.tumblr.com/oauth/request_token"];
    
    
    
    
    
    
    
    OAMutableURLRequest* requestTokenRequest = [[OAMutableURLRequest alloc] initWithURL:requestTokenUrl consumer:consumer token:nil realm:nil signatureProvider:nil nonce:nil timestamp:@"1416360846"];
    
    OARequestParameter* callbackParam = [[OARequestParameter alloc] initWithName:@"oauth_callback" value:redirect] ;
    
    [requestTokenRequest setHTTPMethod:@"POST"];
    
    [requestTokenRequest setParameters:[NSArray arrayWithObject:callbackParam]];
    
    
    
    OADataFetcher* dataFetcher = [[OADataFetcher alloc] init] ;
    
    [dataFetcher fetchDataWithRequest:requestTokenRequest
    
                             delegate:self
    
                    didFinishSelector:@selector(didReceiveRequestToken:data:)
    
                      didFailSelector:@selector(didFailOAuth:error:)];
    

    } - (void)didFailOAuth:(NSString *)error {

    }

  • (void)didReceiveRequestToken :( OAServiceTicket *)票据数据:(NSData *)data {

    NSString * httpBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

    requestToken = [[OAToken alloc] initWithHTTPResponseBody:httpBody];

    NSURL * authorizeUrl = [NSURL URLWithString:@“https://www.tumblr.com/oauth/authorize”];

    OAMutableURLRequest * authorizeRequest = [[OAMutableURLRequest alloc] initWithURL:authorizeUrl

                                                                        consumer:nil
    
                                                                           token:nil
    
                                                                           realm:nil
    
                                                               signatureProvider:nil];
    

    NSString * oauthToken = requestToken.key;

    OARequestParameter * oauthTokenParam = [[OARequestParameter alloc] initWithName:@“oauth_token”value:oauthToken];

    [authorizeRequest setParameters:[NSArray arrayWithObject:oauthTokenParam]];

    [WebView loadRequest:authorizeRequest];

  • }

    请参阅我也调试代码

    现在我该如何解决这个问题?

    我使用相同的方法在twitter上工作,但不为Tumblr工作

    此外,我手动尝试使网址,但它也不工作

    https://www.tumblr.com/oauth/request_token?oauth_consumer_key=zKJI0u2qC4u9fZzSzDNit289fjYy7zytDevTD0zv1QWzxqSUcb&oauth_signature_method=HMAC-SHA1

    请帮我出去:(

    我做了很多搜索,但发现了可笑的答案

    链接地址: http://www.djcxy.com/p/72687.html

    上一篇: signature does not match expected value oAuth Tumblr Request

    下一篇: UIPopoverController keeps reloading UIWebView