gpt4 book ai didi

android - 访问连接被拒绝 new linkedin Android SDK

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:03:07 28 4
gpt4 key购买 nike

根据文档和 Linkedin 新示例应用程序,我使用新的 Linkedin Android SDK 时遇到“访问连接被拒绝”错误:-

APIHelper apiHelper = APIHelper
.getInstance(getApplicationContext());
apiHelper.getRequest(ApiActivity.this, "https://" + host
+ "/v1/people/~/connections:(first-name,last-name,public-profile-url)",
new ApiListener() {
@Override
public void onApiSuccess(ApiResponse s) {
((TextView) findViewById(R.id.response))
.setText(s.toString());
}

@Override
public void onApiError(LIApiError error) {
((TextView) findViewById(R.id.response))
.setText(error.toString());
}
});

最佳答案

Agree OAuth User Agreement: Neither r_basicprofile nor r_fullprofile is checked for getting access to user profile.follow url can be use to fetch profile information from LinkedIn.

Default Scope:
r_basicprofile
r_fullprofile

User the following urls to fetch LinkedIn data.

    private static final String HOST = "api.linkedin.com";
private static final String FETCH_BASIC_INFO = "https://" + host + "/v1/people/~:(id,first-name,last-name,headline,location,industry)";
private static final String FETCH_CONTACT = "https://" + host + "/v1/people/~:(num-connections,email-address,phone-numbers,main-address)";
private static final String FETCH_PROFILE_PIC = "https://" + host + "/v1/people/~:(picture-urls::(original))";
private static final String SHARE_URL = "https://" + host + "/v1/people/~/shares";

Don't forget to set permission for accessing above info at both mobile app as well as while registering app in LinkedIn


 private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.W_SHARE, Scope.R_EMAILADDRESS, Scope.R_CONTACTINFO); }

Example code follows

LISessionManager.getInstance(context).init(context, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {

}

@Override
public void onAuthError(LIAuthError error) {

}
}, true);

关于android - 访问连接被拒绝 new linkedin Android SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30237542/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com