jeyben / IOSLinkedInAPI

Simple and non intrusive library to get access tokens for LinkedIn using Oauth2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting Error in Post Status request

paritoshraval100 opened this issue · comments

Hi, it's really a good API.can you give me an example of post status request ? I am using your API and trying to post it by

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:@"comment", @"TEST", nil];
NSString *url = [NSString stringWithFormat:@"https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=%@",accesToken];
[self postPath:url parameters:params success:^(AFHTTPRequestOperation *operation, NSDictionary *accessToken) {
NSLog(@"dictionary is :%@",accessToken);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error :%@",[error description]);
}];
where accesToken is what i get by NSString *accessToken = [accessTokenData objectForKey:@"access_token"];

but getting error :{NSLocalizedRecoverySuggestion={
"errorCode": 0,
"message": "Access to posting shares denied",
"requestId": "KP3O4JQCD5",
"status": 403,
"timestamp": 1379659659933
}

Hi,

At first glance it seems like you are doing it correctly, but my best guess is that the user hasn't granted the necessary rights to the app. Have you requested 'rw_nus' rights as it states here: http://developer.linkedin.com/documents/share-api

The error you get from linked in is also discussed here. Maybe you can get inspiration here? https://developer.linkedin.com/forum/403-write-apis

Regards Jacob

thanks for your reply , i have checked all the permission event thought getting this error. i am reading some post related it currently but not getting feasible solution.And in your solution why you set http://www.ancientprogramming.com ? do i have to set accept redirected URL or cancelRedirected URL in my app on developer-linkedin ?

it is working fine with oAuth version 1 , with OAMutableURLRequest i can add status.getting error with this code with AFNetworking only , so may be a problem in my request format or url

Hi, it was my mistake i was working with , i set all permission from web application linked in , but using your code as NSArray *grantedAccess = @[@"r_fullprofile", @"r_network,"]; so it is accepting only two permission...

But i find new problem with post request , i don't think it is working with your postrequest and paramters in AFNetworking.For That you have to set NSMutableURLRequest and have to set properties according to request.

I don't see/understand how AFNetworking limits you post abilities towards linked in. As soon as you have the access token, you should be able to do all http call types that linked in allows using the very generic AFNetworking api?

I will close the issue for now. If it is still a problem file another issue with some details and I will look at it.