I have an iPad app and need to integrate vimeo to it. I'm in the initial stages of integrating it to my app. I first need to authenticate my app through vimeo.
I've gone through the steps for authentication in documentation and I'm able to pass through first 2 steps:
Request Token: http://vimeo.com/oauth/request_token
User Authorization: http://vimeo.com/oauth/authorize
But unable to get oauth_token
and oauth_token_secret
through last step:
Access Token: http://vimeo.com/oauth/access_token
Vimeo redirects to callback url instead of going back to the app which is fine until I get verifier and authorization token. But once I use these to get oauth_token
and oauth_token_secret
, console shows following error message:
Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed.
(NSURLErrorDomain error -1012.)" UserInfo=0x18146180 {
NSErrorFailingURLKey=http://vimeo.com/oauth/access_token?oauth_token=141b4ff56c48dc5d03501297bde85ebc&oauth_verifier=land-1886924229,
NSErrorFailingURLStringKey=http://vimeo.com/oauth/access_token?oauth_token=141b4ff56c48dc5d03501297bde85ebc&oauth_verifier=land-1886924229,
NSUnderlyingError=0x181483d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"
}
Can anyone please help or atleast provide some directions?
To further give an insight, I'm using OAuthConsumer
framework. Below are the lines of code where we place request to get an access token:
- (void)successfulAuthorizationWithToken:(NSString *)token verifier:(NSString *)verifier {
NSLog(@"successfulAuthorizationWithToken");
OAMutableURLRequest *request;
OADataFetcher *fetcher;
//NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"];
NSURL *url = [NSURL URLWithString:@"http://vimeo.com/oauth/access_token"];
request = [[[OAMutableURLRequest alloc] initWithURL:url
consumer:self.consumer
token:self.accessToken
realm:nil
signatureProvider:nil autorelease];
OARequestParameter *p0 = [[OARequestParameter alloc] initWithName:@"oauth_token"
value:token];
OARequestParameter *p1 = [[OARequestParameter alloc] initWithName:@"oauth_verifier"
value:verifier];
NSArray *params = [NSArray arrayWithObjects:p0, p1, nil];
[request setParameters:params];
fetcher = [[[OADataFetcher alloc] init] autorelease];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(accessTokenTicket:didFinishWithData:)
didFailSelector:@selector(accessTokenTicket:didFailWithError:)];
[p0 release];
[p1 release];
}
I've also tried solutions specified in below link: Twitter API + OAuthConsumer.framework
It says to use [[[OAHMAC_SHA1SignatureProvider alloc] init] autorelease]
as signatureProvider
. But the results are same.
I need to get following values after I get verifier and authorized token using the access token step:
oauth_token=YourAuthorizedOauthToken&oauth_token_secret=YourAuthorizedTokenSecret
Finally got it working. There were issues in the base string and oAuth Header string format.