|
@@ -223,9 +223,8 @@ public class ChatGptAuthServiceImpl implements ChatGptAuthService {
|
|
|
while (sb.length() < 6) {
|
|
while (sb.length() < 6) {
|
|
|
sb.insert(0, 0);
|
|
sb.insert(0, 0);
|
|
|
}
|
|
}
|
|
|
- four(codeVerifier, Location, code, username);
|
|
|
|
|
- }
|
|
|
|
|
- if (Location.contains("com.openai.chat://auth0.openai.com/ios/com.openai.chat/callback?")) {
|
|
|
|
|
|
|
+ return four(codeVerifier, Location, code, username);
|
|
|
|
|
+ } else if (Location.contains("com.openai.chat://auth0.openai.com/ios/com.openai.chat/callback?")) {
|
|
|
return getAccessToken(codeVerifier, Location, username);
|
|
return getAccessToken(codeVerifier, Location, username);
|
|
|
} else {
|
|
} else {
|
|
|
log.info("Login callback failed.");
|
|
log.info("Login callback failed.");
|
|
@@ -234,7 +233,7 @@ public class ChatGptAuthServiceImpl implements ChatGptAuthService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void four(String codeVerifier, String location, long code, String username){
|
|
|
|
|
|
|
+ private String four(String codeVerifier, String location, long code, String username){
|
|
|
String url = "https://auth0.openai.com" + location;
|
|
String url = "https://auth0.openai.com" + location;
|
|
|
Map<String, String> paramMap = HttpUtil.decodeParamMap(url, IoKit.Charsets.UTF_8.getCharset());
|
|
Map<String, String> paramMap = HttpUtil.decodeParamMap(url, IoKit.Charsets.UTF_8.getCharset());
|
|
|
|
|
|
|
@@ -255,9 +254,10 @@ public class ChatGptAuthServiceImpl implements ChatGptAuthService {
|
|
|
if (execute.getStatus() == 302) {
|
|
if (execute.getStatus() == 302) {
|
|
|
String Location = execute.header("Location");
|
|
String Location = execute.header("Location");
|
|
|
if (Location.contains("/authorize/resume?")) {
|
|
if (Location.contains("/authorize/resume?")) {
|
|
|
- three(codeVerifier, Location, url, username);
|
|
|
|
|
|
|
+ return three(codeVerifier, Location, url, username);
|
|
|
} else {
|
|
} else {
|
|
|
log.info("Login failed.");
|
|
log.info("Login failed.");
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("four Login failed.");
|
|
|
}
|
|
}
|
|
|
} else if (execute.getStatus() == 400) {
|
|
} else if (execute.getStatus() == 400) {
|
|
|
throw BusinessRuntimeException.getInstance("wrong MFA code.");
|
|
throw BusinessRuntimeException.getInstance("wrong MFA code.");
|