Quantcast
Channel: LivePerson Connect : Popular Discussions - All Communities
Viewing all articles
Browse latest Browse all 2324

OAuth wrong credentials

$
0
0

I'm trying to create a signed request on my phone app using the OAuthConsumer Library. My code is very simple and just sends the request with the token information I got after installing they key.

 

 

And then I would assume that the body in the response would have what I need. It's in the callback below.

 

The response I get whenever I make this request is wrong credentials. Am I using the wrong URL? Or am I suppose to enter some other information here?

 

All help would be greatly appreciated.

 

Thanks.

 

 

 

    OAConsumer *consumer = [[OAConsumer alloc] initWithKey:@"KEY"

                                                    secret:@"SECRET"];

 

    NSURL *url = [NSURL URLWithString:@"http://sales.liveperson.net/api/account/P5625930/chat/availability?v=1"];

    OAToken *tokener = [[OAToken alloc] initWithKey:@"tokenkey" secret:@"tokensecret"];

    OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url

                                                                   consumer:consumer

                                                                      token:tokener

                                                                      realm:nil   // our service provider doesn't specify a realm

                                                          signatureProvider:nil]; // use the default method, HMAC-SHA1

 

    [request setHTTPMethod:@"POST"];

    NSLog(@"Oauth request: %@", request);

    OADataFetcher *fetcher = [[OADataFetcher alloc] init];

 

    [fetcher fetchDataWithRequest:request

                         delegate:self

                didFinishSelector:@selector(requestTokenTicket:didFinishWithData:)

                  didFailSelector:@selector(requestTokenTicket:didFailWithError:)];

 

 

- (void)requestTokenTicket:(OAServiceTicket *)ticket didFinishWithData:(NSData *)data {

    NSString *responseBody = [[NSString alloc] initWithData:data

                                                   encoding:NSUTF8StringEncoding];

 

    NSLog(@"data: %@", responseBody);

    if (ticket.didSucceed) {

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

        OAToken *requestToken = [[OAToken alloc] initWithHTTPResponseBody:responseBody];

        NSLog(@"Token is %@", requestToken.secret);

 

    }

}


Viewing all articles
Browse latest Browse all 2324

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>