繁体   English   中英

分享有关linkedin 不适用于新v2 Api 的文章

[英]Share articles on linkedin not working with new v2 Api's

我们有一个应用程序,我们在其中使用Linkedin 的社交媒体共享,之前该应用程序使用v1 Api 并且帖子共享工作正常,但现在突然停止工作。 我查了谷歌似乎是v1的API现在已经过时了,所以我尝试使用V2的API。 但现在我得到以下错误-:

Domain=com.alamofire.error.serialization.response Code=-1011 “请求失败:禁止(403)” UserInfo={NSLocalizedDescription=请求失败:禁止(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 传递更多参数,有人可以帮助我吗? 提前致谢。

如果需要任何其他信息,请告诉我。

根据LinkedIn Share API v2.0 ,您的 HTTP 调用应如下所示:

POST https://api.linkedin.com/v2/shares

json:

{
    "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!"
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM