Skip to content

Commit

Permalink
fix the yml
Browse files Browse the repository at this point in the history
  • Loading branch information
liberhe committed Jan 10, 2024
2 parents b93598d + 875591d commit ea4ca38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,27 @@ public BaseResponse<String> receiveAuthorizationCode(
throw new RuntimeException("Failed to get access token id ");
}
String accessToken = accessTokenResponse.getAccessToken();
log.info("access token received");
log.info("access token received: {}", accessToken);
return BaseResponse.successWithData(accessToken);
/**
* 3. Get user info via access_token
*/
IUserInfoRetrieveHandler retrieveHandler = this.userInfoRetrieveHandlers.get(registrationId);
Assert.notNull(retrieveHandler, "retrieveHandler not found:"+registrationId);
IUserInfo userInfo = retrieveHandler.retrieve(registration.getUserInfoUri(), accessToken);
log.info("user info {}", userInfo.getUsername());
Assert.notNull(userInfo, "failed to find userInfo");
// IUserInfoRetrieveHandler retrieveHandler = this.userInfoRetrieveHandlers.get(registrationId);
// Assert.notNull(retrieveHandler, "retrieveHandler not found:"+registrationId);
// IUserInfo userInfo = retrieveHandler.retrieve(registration.getUserInfoUri(), accessToken);
// log.info("user info {}", userInfo.getUsername());
// Assert.notNull(userInfo, "failed to find userInfo");
/**
* 4. Bind userInfo
*/
IOAuthBindHandler bindHandler = this.bindHandlers.get(registrationId);
Assert.notNull(bindHandler, "bindHandler not found:"+registrationId);

bindHandler.bind(UserSecurityUtils.getUserLogin().getAddress(), userInfo);

response.addCookie(new Cookie("oauth_"+registrationId, userInfo.getUsername()));
return BaseResponse.successWithData(userInfo.getUsername());
// IOAuthBindHandler bindHandler = this.bindHandlers.get(registrationId);
// Assert.notNull(bindHandler, "bindHandler not found:"+registrationId);
//
// bindHandler.bind(UserSecurityUtils.getUserLogin().getAddress(), userInfo);
//
// response.addCookie(new Cookie("oauth_"+registrationId, userInfo.getUsername()));
// return BaseResponse.successWithData(userInfo.getUsername());
}

@GetMapping("username/{registrationId}")
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ oauth:
clientId: "${TWITTER_CLIENT_KEY}"
clientSecret: "${TWITTER_CLIENT_SECRET}"



qcloud:
#初始化用户身份信息 前往控制台密钥管理查看
secretId: ${SECRET_ID}
Expand Down

0 comments on commit ea4ca38

Please sign in to comment.