LinkedIn 集成 Android 移动 SDK 电子邮件 ID 未获取
LinkedIn integration Android mobile SDK email id not fetching
我同意 OAuth 用户协议:
默认范围:
r_basicprofile
r_fullprofile
URL
private static final String host = "api.linkedin.com";
private static final String PROTECTED_URL_GET_CURRENT_USER_PROFILE = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,industry)";
除电子邮件地址外,我得到的都是其他信息。?有人知道为什么吗?
构建范围时必须指定电子邮件权限Scope.R_EMAILADDRESS
例如
private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.W_SHARE,Scope.R_EMAILADDRESS);
}
linkedin 网址
private static final String host = "api.linkedin.com";
private static final String topCardUrl = "https://" + host
+ "/v1/people/~:(id,first-name,last-name,public-profile-url,picture-url,email-address,picture-urls::(original))";
这是登录码
public void login() {
LISessionManager sessionManager = LISessionManager
.getInstance(context);
LISession session = sessionManager.getSession();
boolean accessTokenValid = session.isValid();
if (accessTokenValid) {
getProfile();
} else {
LISessionManager.getInstance(context).init(context, buildScope(),
new AuthListener() {
@Override
public void onAuthSuccess() {
loginSuccess(LISessionManager.getInstance(context)
.getSession().getAccessToken());
}
@Override
public void onAuthError(LIAuthError error) {
loginFailed(error);
}
}, true);
}
}
这是为了获取个人资料
public void getProfile() {
APIHelper apiHelper = APIHelper.getInstance(context);
apiHelper.getRequest(context, topCardUrl, new ApiListener() {
@Override
public void onApiSuccess(ApiResponse s) {
onProfileSuccess(s);
}
@Override
public void onApiError(LIApiError error) {
onProfileError(error);
}
});
}
我同意 OAuth 用户协议:
默认范围: r_basicprofile r_fullprofile
URL
private static final String host = "api.linkedin.com";
private static final String PROTECTED_URL_GET_CURRENT_USER_PROFILE = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,industry)";
除电子邮件地址外,我得到的都是其他信息。?有人知道为什么吗?
构建范围时必须指定电子邮件权限Scope.R_EMAILADDRESS
例如
private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.W_SHARE,Scope.R_EMAILADDRESS);
}
linkedin 网址
private static final String host = "api.linkedin.com";
private static final String topCardUrl = "https://" + host
+ "/v1/people/~:(id,first-name,last-name,public-profile-url,picture-url,email-address,picture-urls::(original))";
这是登录码
public void login() {
LISessionManager sessionManager = LISessionManager
.getInstance(context);
LISession session = sessionManager.getSession();
boolean accessTokenValid = session.isValid();
if (accessTokenValid) {
getProfile();
} else {
LISessionManager.getInstance(context).init(context, buildScope(),
new AuthListener() {
@Override
public void onAuthSuccess() {
loginSuccess(LISessionManager.getInstance(context)
.getSession().getAccessToken());
}
@Override
public void onAuthError(LIAuthError error) {
loginFailed(error);
}
}, true);
}
}
这是为了获取个人资料
public void getProfile() {
APIHelper apiHelper = APIHelper.getInstance(context);
apiHelper.getRequest(context, topCardUrl, new ApiListener() {
@Override
public void onApiSuccess(ApiResponse s) {
onProfileSuccess(s);
}
@Override
public void onApiError(LIApiError error) {
onProfileError(error);
}
});
}