⚡ 优化代码
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.JSONPath;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.config.AuthSource;
|
||||
import me.zhyd.oauth.enums.AuthUserGender;
|
||||
@@ -120,13 +121,8 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
|
||||
.execute();
|
||||
JSONObject emailObj = JSONObject.parseObject(emailResponse.body());
|
||||
this.checkResponse(emailObj);
|
||||
if (emailObj.containsKey("elements")) {
|
||||
email = emailObj.getJSONArray("elements")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("handle~")
|
||||
.getString("emailAddress");
|
||||
}
|
||||
return email;
|
||||
Object obj = JSONPath.eval(emailObj, "$['elements'][0]['handle~']['emailAddress']");
|
||||
return null == obj ? null : (String) obj;
|
||||
}
|
||||
|
||||
private String getUserName(JSONObject userInfoObject, String nameKey) {
|
||||
|
||||
Reference in New Issue
Block a user