LISDKErrorAPIDomain错误403
LISDKErrorAPIDomain error 403
我正在尝试通过我的应用程序将 url、图片和文本分享到 linkedin。但它显示错误
The operation couldn’t be completed. (LISDKErrorAPIDomain error 403.)
我的密码是
func didLinkedinBtnPressed(cellObject: MyModel) {
let tmp = ["comment": cellObject.strSocialText!,
"content": ["title":"AppName", "description":cellObject.strSocialText!,"submitted-url":cellObject.strWebSite!,"submitted-image-url":cellObject.strImageUrl!],"visibility": ["code": "anyone"]] as [String : Any]
print("PostDtaa = \(tmp)")
let postData = try? JSONSerialization.data(withJSONObject: tmp, options: .prettyPrinted)
let url = NSString(string:"https://api.linkedin.com/v1/people/~/shares?format=json")
let permissions: [AnyObject] = [LISDK_BASIC_PROFILE_PERMISSION as AnyObject, LISDK_EMAILADDRESS_PERMISSION as AnyObject,LISDK_W_SHARE_PERMISSION as AnyObject]
LISDKSessionManager.createSession(withAuth: permissions, state: nil, showGoToAppStoreDialog: true, successBlock: { (success) -> () in
if LISDKSessionManager.hasValidSession() {
LISDKAPIHelper.sharedInstance().postRequest(url as String, body: postData, success: { (_ response) in
print(response ?? "")
self.simpleAlert(titleOfAlert: "Success", messageOfAlert: "Shared Successfully")
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
}, error: { (_errorRes) in
print(_errorRes?.localizedDescription ?? "No Error!!!")
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
})
}
}, errorBlock: { (error) -> () in
print("%s", "error called!")
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
})
}
为什么我在这里收到 403 错误?
我过去试验过类似的问题,它与 w_share 权限有关
来自 linkedin doc
Required permission: w_share
Whether set as a default permission in your app settings or requested
specifically via the scope argument during your authentication
process, you will need to request the w_share member permission in
order for your application to successfully make the API call to share
content.
w_share 默认情况下禁用,因此必须明确启用
注意:令牌可以由应用程序缓存,因此为了确保使用新令牌(具有更新的权限),我强烈建议您从移动设备上卸载所有内容并重新安装.
我正在尝试通过我的应用程序将 url、图片和文本分享到 linkedin。但它显示错误
The operation couldn’t be completed. (LISDKErrorAPIDomain error 403.)
我的密码是
func didLinkedinBtnPressed(cellObject: MyModel) {
let tmp = ["comment": cellObject.strSocialText!,
"content": ["title":"AppName", "description":cellObject.strSocialText!,"submitted-url":cellObject.strWebSite!,"submitted-image-url":cellObject.strImageUrl!],"visibility": ["code": "anyone"]] as [String : Any]
print("PostDtaa = \(tmp)")
let postData = try? JSONSerialization.data(withJSONObject: tmp, options: .prettyPrinted)
let url = NSString(string:"https://api.linkedin.com/v1/people/~/shares?format=json")
let permissions: [AnyObject] = [LISDK_BASIC_PROFILE_PERMISSION as AnyObject, LISDK_EMAILADDRESS_PERMISSION as AnyObject,LISDK_W_SHARE_PERMISSION as AnyObject]
LISDKSessionManager.createSession(withAuth: permissions, state: nil, showGoToAppStoreDialog: true, successBlock: { (success) -> () in
if LISDKSessionManager.hasValidSession() {
LISDKAPIHelper.sharedInstance().postRequest(url as String, body: postData, success: { (_ response) in
print(response ?? "")
self.simpleAlert(titleOfAlert: "Success", messageOfAlert: "Shared Successfully")
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
}, error: { (_errorRes) in
print(_errorRes?.localizedDescription ?? "No Error!!!")
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
})
}
}, errorBlock: { (error) -> () in
print("%s", "error called!")
LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
})
}
为什么我在这里收到 403 错误?
我过去试验过类似的问题,它与 w_share 权限有关
来自 linkedin doc
Required permission: w_share
Whether set as a default permission in your app settings or requested specifically via the scope argument during your authentication process, you will need to request the w_share member permission in order for your application to successfully make the API call to share content.
w_share 默认情况下禁用,因此必须明确启用
注意:令牌可以由应用程序缓存,因此为了确保使用新令牌(具有更新的权限),我强烈建议您从移动设备上卸载所有内容并重新安装.