Topic-icon Error with LinkedIn channel

Hi,

after creating a channel for LinkedIn, we are getting the error:
Too few arguments to function JFBConnectUtilities::getResponseBody(), 0 passed in /home/mgsolution/domains/mg-solutions.nl/public_html/u/plugins/jfbconnect/provider_linkedin/provider/linkedin/channel/company.php on line 60 and exactly 1 expected

Frontend for linked user also show an error after linkedin connection, no route found.

Already reinstalled and gone through all the settings again, but it all seems to be correct.

Can you advise?
The topic has been locked.
Support Specialist
2 years 7 months ago #67407 by mel
Replied by mel on topic Error with LinkedIn channel
In /home/mgsolution/domains/mg-solutions.nl/public_html/u/plugins/jfbconnect/provider_linkedin/provider/linkedin/channel/company.php at line 60,

can you change
$nameData = json_decode(JFBConnectUtilities::getResponseBody());
to
$nameData = json_decode(JFBConnectUtilities::getResponseBody($response));

and try again?

-Melissa
The topic has been locked.
2 years 7 months ago #67408 by [email protected]
Hi Melissa,

that indeed helps to solve the general error, did cause a new error on frontpage though.

Error code 401 received requesting data: {"serviceErrorCode":65604,"message":"Empty oauth2 access token","status":401}.
The topic has been locked.
Support Specialist
2 years 7 months ago #67409 by mel
Replied by mel on topic Error with LinkedIn channel
Are there any errors in the LinkedIn channels in the backend? That error suggests to me that the token might have expired. While we need to handle that better, I would suggest using SCLogin to log in to LinkedIn again, accepting any authorization prompts, and then checking again.
The topic has been locked.
2 years 7 months ago #67410 by [email protected]
Backend error when I log in to LinkedIn again.

LinkedIn API Error: Error code 403 received requesting data: {"serviceErrorCode":100,"message":"Field Value validation failed in PARAMETER: Data Processing Exception while processing fields [/authors/authors]","status":403}.

FrontEnd still shows same error
The topic has been locked.
2 years 7 months ago #67411 by [email protected]
Guessing it has something to do with the links, cause the links in the LinkedIn feed all link to the homepage of the site, instead of to LinkedIn itself
The topic has been locked.
Support Specialist
2 years 7 months ago #67412 by mel
Replied by mel on topic Error with LinkedIn channel
The error indicates that it's having trouble accessing the endpoint that fetches all of the user posts for the company. Looking at the documentation, the 403 error coded indicates that there's not enough permissions to access this endpoint.

docs.microsoft.com/en-us/linkedin/market...c-post-api?tabs=http

Are you a member of the LinkedIn Marketing Developer Program? Membership is required for access to the endpoint.

-Melissa
The topic has been locked.
2 years 7 months ago #67413 by [email protected]
Yes, I am a member of the program.

Also, the feed itself is showing with correct LinkedIn posts (with wrong hyperlinks as mentioned in my previous post).

The error in the backend is only there on the initial save on the channel. After that, the backend doesn't give any errors anymore.
The topic has been locked.
Support Specialist
2 years 7 months ago #67414 by mel
Replied by mel on topic Error with LinkedIn channel
Gotcha. Then the initial backend error was probably a token issue and was resolved after you logged in again and refreshed the channel.

Looking at the code, the link is not set properly after retrieving the posts, so when the stream module tries to display it, it just uses an empty link which will go to your homepage.

We have a hard time debugging LinkedIn as we've repeatedly tried to request access to the Developer Program but have been unsuccessful so far. :(

If you want to try to fix the link, can you try the following? In /plugins/jfbconnect/provider_linkedin/provider/linkedin/channel/company.php around line 181, change
//$post->link = self::getShareLink($this->provider->client, $data->id);
to
$post->link = self::getShareLink($this->provider->client, $data->id);
.

If instead, you'd like to remove the link, you'll have to do a theme override of /media/sourcecoast/themes/scsocialstream/default/linkedin.php. Line 23 and line 46 is what prints out the link.
The topic has been locked.
2 years 7 months ago #67415 by [email protected]
Ok, will fix the hyperlinks to point to our company page on LinkedIn.

Just noticed a strange thing. On the frontend, when a user is authenticated with linkedin through jfbconnect:

Displays no error, company name by post.

When a guest (not logged in visitor) visited the front page:

Error is displayed and company name in posts is replaced by "id: xxxx"

Company name I can also fix in the code I think, but how can I not display the error when a guest visites our page?
The topic has been locked.