我们有一款与Linkedin一起使用社交媒体共享的应用程序,早些时候该应用程序使用的是v1 Api,而post共享则运行良好,但现在它突然停止工作了。我在google上查看过,似乎v1应用程序现在已不再受欢迎,所以我尝试使用v2 api。
Domain=com.alamofire.error.serialization.response代码=-1011“请求失败:UserInfo= (403)”UserInfo={NSLocalizedDescription=Request失败:禁止(403)
下面是我要传递访问权限和获取访问令牌的所有其他参数的代码。
- (LIALinkedInHttpClient *)client {
UIViewController *top = [UIApplication sharedApplication].keyWindow.rootViewController;
// [top presentViewController:secondView animated:YES completion: nil];
LIALinkedInApplication *application = [LIALinkedInApplication applicationWithRedirectURL:@"https://com.xxxxxx.linkedin.oauth/oauth"
clientId:@"xxxxxxxxx"
clientSecret:@"xxxxxxxx"
state:@"xxxxxxxxx"
grantedAccess:@[@"w_member_social"]];
return [LIALinkedInHttpClient clientForApplication:application presentingViewController:top.presentedViewController]; //[LIALinkedInHttpClient clientForApplication:application];
}v2 URL -:https://www.linkedin.com/oauth/v2/shared?/accessToken,此处accessToken是在控制台中检查该值时附加到该URL的有效令牌值。
我不知道如何使用v2的Api进行有效的请求,或者如果有更多的参数需要传递给新的Api,有人能在这方面帮助我吗?提前谢谢。
如果需要任何其他信息,请告诉我。
发布于 2019-12-29 12:49:49
根据LinkedIn共享APIv2.0,您的HTTP调用应该如下所示:
POST https://api.linkedin.com/v2/shares杰森:
{
"content": {
"contentEntities": [
{
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [
{
"resolvedUrl": "https://www.example.com/image.jpg"
}
]
}
],
"title": "Test Share with Content"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:person:324_kGGaLE",
"subject": "Test Share Subject",
"text": {
"text": "Test Share!"
}
}https://stackoverflow.com/questions/59183715
复制相似问题