提交 e2e1a082 编写于 作者: 不合群的混子's avatar 不合群的混子

🐛 修复小米回调错误的问题

上级 3b80e118
...@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.config.AuthConfig; import me.zhyd.oauth.config.AuthConfig;
import me.zhyd.oauth.config.AuthSource; import me.zhyd.oauth.config.AuthSource;
import me.zhyd.oauth.exception.AuthException; import me.zhyd.oauth.exception.AuthException;
...@@ -19,6 +20,7 @@ import java.text.MessageFormat; ...@@ -19,6 +20,7 @@ import java.text.MessageFormat;
* @version 1.5 * @version 1.5
* @since 1.5 * @since 1.5
*/ */
@Slf4j
public class AuthMiRequest extends BaseAuthRequest { public class AuthMiRequest extends BaseAuthRequest {
private static final String PREFIX = "&&&START&&&"; private static final String PREFIX = "&&&START&&&";
...@@ -86,6 +88,8 @@ public class AuthMiRequest extends BaseAuthRequest { ...@@ -86,6 +88,8 @@ public class AuthMiRequest extends BaseAuthRequest {
if (!"error".equalsIgnoreCase(userEmailPhone.getString("result"))) { if (!"error".equalsIgnoreCase(userEmailPhone.getString("result"))) {
JSONObject emailPhone = userEmailPhone.getJSONObject("data"); JSONObject emailPhone = userEmailPhone.getJSONObject("data");
authUser.setEmail(emailPhone.getString("email")); authUser.setEmail(emailPhone.getString("email"));
}else {
log.warn("小米开发平台暂时不对外开放用户手机及邮箱信息的获取");
} }
return authUser; return authUser;
......
...@@ -87,7 +87,7 @@ public class UrlBuilder { ...@@ -87,7 +87,7 @@ public class UrlBuilder {
private static final String MICROSOFT_USER_INFO_PATTERN = "{0}"; private static final String MICROSOFT_USER_INFO_PATTERN = "{0}";
private static final String MICROSOFT_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"; private static final String MICROSOFT_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token";
private static final String MI_AUTHORIZE_PATTERN = "{0}?client_id={1}&redirect_uri={2}&response_type=code&scope=1%203%204%206&state={3}&skip_confirm=false"; private static final String MI_AUTHORIZE_PATTERN = "{0}?client_id={1}&redirect_uri={2}&response_type=code&scope=user/profile%20user/openIdV2%20user/phoneAndEmail&state={3}&skip_confirm=false";
private static final String MI_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&code={4}&grant_type=authorization_code"; private static final String MI_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&code={4}&grant_type=authorization_code";
private static final String MI_USER_INFO_PATTERN = "{0}?clientId={1}&token={2}"; private static final String MI_USER_INFO_PATTERN = "{0}?clientId={1}&token={2}";
private static final String MI_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"; private static final String MI_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册