LinkedIn IOS API Error

I am trying to implement this LinkedIn library in my project, but it seems that I am getting an error while I try to present a LinkedIn screen

LinkedIn1 authorization error: Domain error = LIALinkedInERROR Code = 1 "Operation could not be completed (error LIALinkedInERROR 1.)"

You can find the code I'm using here .

+2
source share
5 answers

May this information help you -

enter image description here

API Terms of Use

Transition Guide

+5
source

I also ran into the same problem. My mistake: Error Domain = LIALinkedInERROR Code = 2. On May 26, 2016 Linkedin again made some changes, due to which an additional "#!" are added to the state, and as a result, the state does not match in the LIALinkedInAuthorizationViewController class. So the solution is to remove these 2 characters either by replacing the string or by checking the string.

Another part of this method - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

change to `

  NSString *receivedState = [[self extractGetParameter:@"state" fromURLString: url] stringByReplacingOccurrencesOfString:@"#!" withString:@""]; 

`or apply contains a string to match the state completely.

I know this is a strange solution, but it helped me. Hope this helps you. All the best

enter image description here

+11
source

Since May 12, the Linkedin API has changed. From now on, all applications requesting r_contactinfo must be approved by LinkedIn. This link explains the changes.

I use this library and I just needed to change the permissions from @"r_contactinfo" to @"r_basicprofile", @"r_emailaddress" .

Also, be sure to change the permissions of the applications on developer.linkedin.com to match the above.

+3
source

You should use:

 code=https://www.linkedin.com/oauth/v2/authorization? 

Instead:

 code=https://www.linkedin.com//uas/oauth2/authorization? 

Also in linkedin api:

 LIALinkedInAuthorizationViewController.m LIALinkedInHttpClient 

Edit:

 NSString *accessTokenUrl = @"/uas/oauth2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@"; 

By:

 NSString *accessTokenUrl = @"/oauth/v2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@"; 
+2
source

Jack's answer is absolutely right, Jack's answer . In addition to this, you can also use this LinkedinIOSHelper library, it is easy to use

0
source

Source: https://habr.com/ru/post/1402844/


All Articles