Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth的userinfo接口去掉了? #716

Open
joychou996 opened this issue Dec 9, 2024 · 1 comment
Open

oauth的userinfo接口去掉了? #716

joychou996 opened this issue Dec 9, 2024 · 1 comment

Comments

@joychou996
Copy link

joychou996 commented Dec 9, 2024

https://gitee.com/dromara/sa-token/blob/master/sa-token-demo/sa-token-demo-oauth2/sa-token-demo-oauth2-client/src/main/java/com/pj/oauth2/SaOAuthClientController.java

// 根据 Access-Token 置换相关的资源: 获取账号昵称、头像、性别等信息
@RequestMapping("/getUserinfo")
public SaResult getUserinfo(String accessToken) throws JsonProcessingException {
// 调用Server端接口,查询开放的资源
String str = OkHttps.sync(serverUrl + "/oauth2/userinfo")
.addBodyPara("access_token", accessToken)
.post()
.getBody()
.toString();
SoMap so = SoMap.getSoMap().setJsonString(str);
System.out.println("返回结果: " + new ObjectMapper().writeValueAsString(so));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant