diff --git a/server/boot/src/main/resources/META-INF/torna.properties b/server/boot/src/main/resources/META-INF/torna.properties index 18095266a345fe1bc7f82e217588a39db5cf0934..66281289f34c698a8b36c34dc1cc36d9ac39a6b4 100644 --- a/server/boot/src/main/resources/META-INF/torna.properties +++ b/server/boot/src/main/resources/META-INF/torna.properties @@ -123,6 +123,7 @@ torna.login.third-party.oauth.url.authorize= torna.login.third-party.oauth.url.access-token= # \u83B7\u53D6\u7528\u6237\u4FE1\u606F\u7684url torna.login.third-party.oauth.url.user-info= +torna.login.third-party.oauth.key.result-id=id torna.login.third-party.oauth.key.result-username=username torna.login.third-party.oauth.key.result-nickname=name torna.login.third-party.oauth.key.result-email=email diff --git a/server/server-common/src/main/java/cn/torna/common/bean/EnvironmentKeys.java b/server/server-common/src/main/java/cn/torna/common/bean/EnvironmentKeys.java index fa796e8f0a9c8e16cc7d04ae5fff5dbe50e0a42d..2ae30a5cdf7d78fa6af2493a95013f4597c140ac 100644 --- a/server/server-common/src/main/java/cn/torna/common/bean/EnvironmentKeys.java +++ b/server/server-common/src/main/java/cn/torna/common/bean/EnvironmentKeys.java @@ -43,6 +43,7 @@ public enum EnvironmentKeys { LOGIN_THIRD_PARTY_FORM_METHOD("torna.login.third-party.form.method"), /** OAuth scope */ LOGIN_THIRD_PARTY_OAUTH_SCOPE("torna.login.third-party.oauth.scope"), + LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_ID("torna.login.third-party.oauth.key.result-id"), LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_USERNAME("torna.login.third-party.oauth.key.result-username"), LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_NICKNAME("torna.login.third-party.oauth.key.result-nickname"), LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_EMAIL("torna.login.third-party.oauth.key.result-email"), diff --git a/server/server-service/src/main/java/cn/torna/service/login/oauth/DefaultAuthCustomResultParser.java b/server/server-service/src/main/java/cn/torna/service/login/oauth/DefaultAuthCustomResultParser.java index 53fc13346884c7bed2258cea415360b164f7fc1f..f2ba9546d39b37089999bc431329d8084a9e5dd7 100644 --- a/server/server-service/src/main/java/cn/torna/service/login/oauth/DefaultAuthCustomResultParser.java +++ b/server/server-service/src/main/java/cn/torna/service/login/oauth/DefaultAuthCustomResultParser.java @@ -13,7 +13,7 @@ public class DefaultAuthCustomResultParser implements AuthCustomResultParser { @Override public AuthUser parse(String source, AuthToken authToken, JSONObject result) { return AuthUser.builder() - .uuid(result.getString("id")) + .uuid(result.getString(EnvironmentKeys.LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_ID.getValue())) .username(result.getString(EnvironmentKeys.LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_USERNAME.getValue())) .nickname(result.getString(EnvironmentKeys.LOGIN_THIRD_PARTY_OAUTH_KEY_RESULT_NICKNAME.getValue())) .avatar(result.getString("avatar_url"))