簡體   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