我已使用LinkedinSDK进行我的应用登录
我成功检索了代码和令牌响应
但是当我尝试检索用户信息时,出现错误
好的,我建议2
版本的API请求是否需要任何改进。
[self.client GET: [NSString stringWithFormat:@"https://api.linkedin.com/v2/people/~?oauth2_access_token=%@&format=json", accessToken]
parameters:nil
progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (completionHandler) completionHandler(responseObject);
}
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
if (errorHandler) errorHandler(error);
}];
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: forbidden (403)" UserInfo={NSLocalizedDescription=Request failed: forbidden (403), NSErrorFailingURLKey=https://api.linkedin.com/v2/people/~?oauth2_access_token=AQVIGcgZPyW189O5Y6VeSxwDV9Fw_s5g5-UehA5ZA71y0WcNYuj-6lO6a8slsQ007-gyh5rmej7-LfcDPLNg_4jzMNhqpXXhoZnrgIlVUMma-QhdVz_t5a_w13VUjz0RaRXydpbc0j_C9eXiiEWSGNyxd1-_4pWLq2Pf4Aj-Nm7zaLr5-B7wce9-O5PGK8qLxsrG5oiCNUPCa1pa5lAp4T2ZuJnIkfjJuwFEWXuAwg4CXEKhK9fIKyKHk8lqs-EAinrsm2gPnFxtq7HEcHT2RJWiLrljsdfaf_XhCQKtkL5sCcGnL2LkRIP9SN3ovKgS84cW3XEQXv_aFk00V8Yin03By5nFvA&format=json, com.alamofire.serialization.response.error.data=<7b227365 72766963 65457272 6f72436f 6465223a 3130302c 226d6573 73616765 223a224e 6f742065 6e6f7567 68207065 726d6973 73696f6e 7320746f 20616363 6573733a 20474554 202f7065 6f706c65 2f7e222c 22737461 74757322 3a343033 7d>, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x600002f37460> { URL: https://api.linkedin.com/v2/people/~?oauth2_access_token=AQVIGcgZPyW189O5Y6VeSxwDV9Fw_s5g5-UehA5ZA71y0WcNYuj-6lO6a8slsQ007-gyh5rmej7-LfcDPLNg_4jzMNhqpXXhoZnrgIlVUMma-QhdVz_t5a_w13VUjz0RaRXydpbc0j_C9eXiiEWSGNyxd1-_4pWLq2Pf4Aj-Nm7zaLr5-B7wce9-O5PGK8qLxsrG5oiCNUPCa1pa5lAp4T2ZuJnIkfjJuwFEWXuAwg4CXEKhK9fIKyKHk8lqs-EAinrsm2gPnFxtq7HEcHT2RJWiLrljsdfaf_XhCQKtkL5sCcGnL2LkRIP9SN3ovKgS84cW3XEQXv_aFk00V8Yin03By5nFvA&format=json } { Status Code: 403, Headers {
"Content-Length" = (
97
);
"Content-Type" = (
"application/json"
);
Date = (
"Tue, 28 May 2019 10:00:03 GMT"
);
"Set-Cookie" = (
"lidc=\"b=SB76:g=55:u=56:i=1559037602:t=1559123655:s=AQHcwmefisZdAaRpY3d7_Tw2j7IcG0T4\""
);
"x-li-fabric" = (
"prod-lsg1"
);
"x-li-pop" = (
"prod-tmu1-tls13"
);
"x-li-proto" = (
"http/2"
);
"x-li-responseorigin" = (
RGW
);
"x-li-route-key" = (
"\"b=SB76:g=55:u=56:i=1559037602:t=1559123655:s=AQHcwmefisZdAaRpY3d7_Tw2j7IcG0T4\""
);
"x-li-uuid" = (
"EoLXg3DQohWAroT++SoAAA=="
);
"x-restli-gateway-error" = (
true
);
} }}
在这里,我只需要Linkedin个人资料信息,但我得到的只是错误而已。