I need to provide an authorization with LinkedIn for my app. I set up my app by this tutorial: https://developer.linkedin.com/docs/ios-sdk Then, Try to LogIn using this method:
- (void)login:(UIViewController *)controller{
NSArray *permissions = [NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, LISDK_EMAILADDRESS_PERMISSION, LISDK_W_SHARE_PERMISSION, nil];
[LISDKSessionManager createSessionWithAuth:permissions state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnState) {
LISDKSession *session = [[LISDKSessionManager sharedInstance] session];
NSLog(@"Session LINKEDIN: %@", session.description);
NSString *url = [NSString stringWithFormat:@"https://api.linkedin.com/v1/people/~"];
if ([LISDKSessionManager hasValidSession]) {
[[LISDKAPIHelper sharedInstance] getRequest:url
success:^(LISDKAPIResponse *response) {
NSData* data = [response.data dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dictResponse = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSLog(@"Authenticated user name : %@ %@", [dictResponse valueForKey: @"firstName"], [dictResponse valueForKey: @"lastName"]);
} error:^(LISDKAPIError *apiError) {
NSLog(@"Error : %@", apiError);
}];
}
} errorBlock:^(NSError *error) {
NSLog(@"%s","error called!");
}];
}
My app requires to open LinkedIn app, when I enter there my LI login and password, it asks me to confirm my permissions, but then nothing happens. What should I do to perform a correct authorization through LinkedIn? (maybe, there is a way to do this with WebView as FB or Twitter?) Thanks.
Figured out how to receive token using OAuth. Just did all the stuff followed by this tutorial!