提交 96ada343 编写于 作者: 智布道's avatar 智布道 👁

Merge branch 'master' of https://github.com/zhangyd-c/JustAuth

......@@ -24,4 +24,8 @@ public class AuthUser {
private AuthUserGender gender;
private AuthSource source;
private AuthToken token;
/**
* 用户第三方系统的唯一id
*/
private String uuid;
}
......@@ -64,6 +64,7 @@ public class AuthQqRequest extends BaseAuthRequest {
.nickname(object.getString("nickname"))
.avatar(avatar)
.location(object.getString("province") + "-" + object.getString("city"))
.uuid(openId)
.gender(AuthUserGender.getRealGender(object.getString("gender")))
.token(authToken)
.source(AuthSource.QQ)
......
......@@ -31,8 +31,7 @@ public class AuthWeChatRequest extends BaseAuthRequest {
String accessTokenUrl = UrlBuilder.getWeChatAccessTokenUrl(config.getClientId(), config.getClientSecret(), code);
HttpResponse response = HttpRequest.get(accessTokenUrl).execute();
JSONObject object = JSONObject.parseObject(response.body());
if (!object.containsKey("access_token") || !object.containsKey("openid") || !object
.containsKey("refresh_token")) {
if (!object.containsKey("access_token") || !object.containsKey("openid") || !object.containsKey("refresh_token")) {
throw new AuthException("Unable to get access_token or openid or refresh_token from wechat using code [" + code + "]");
}
return AuthToken.builder()
......@@ -58,6 +57,7 @@ public class AuthWeChatRequest extends BaseAuthRequest {
.nickname(object.getString("nickname"))
.avatar(object.getString("headimgurl"))
.location(object.getString("country") + "-" + object.getString("province") + "-" + object.getString("city"))
.uuid(openId)
.gender(AuthUserGender.getRealGender(object.getString("sex")))
.token(authToken)
.source(AuthSource.WECHAT)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册