signature does not match expected value oAuth Tumblr Request

Hello friends I am making login with tumblr using oauth

My problem is I am getting this error in the first step of oauth

oauth_signature does not match expected value

I am using oauth 1.0 library

Here is my first part of code

  • (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*)ticket data:(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];

  • }

    请参阅我也调试代码

    Now how can I solve this problem ?

    I am using the same method its working for twitter but not working for Tumblr

    Also I manually tried to make the URL but its also not working

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

    Please help me out :(

    I did alot of search but worthable answer found

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

    上一篇: 安装ASP.NET MVC 4 Beta后引发InvalidCastException

    下一篇: 签名与期望值oAuth Tumblr请求不符