@Autowired
private RestTemplate httpRestTemplate; String code= request.getParameter("code");
URI url = new URI("http://10.20.60.107:8088/ssoserver/moc2/token");
// 参数拼装
LinkedMultiValueMap<String, String> postParam = new LinkedMultiValueMap<String, String>() ;
postParam.add("grant_type", "authorization_code");
postParam.add("client_id", "222");
postParam.add("client_secret", "45B6E9F1D9A4F10873EB7B2B9BC2CB9AEC11E6AF4ED50980734E62ABFDE91210");
postParam.add("redirect_uri", "http://10.20.60.107:8088/ssoserver/third/oauth/login/callback");
postParam.add("code", code);
ResponseEntity<JSONObject> forEntity = httpRestTemplate.postForEntity(url, postParam, JSONObject.class);
JSONObject object = forEntity.getBody();
String accessToken = object.getString("access_token");

  

最新文章

  1. Struts2入门(四)——数据输入验证
  2. 外网访问内网工具ngrok tunnel 使用总结
  3. 关于html转pdf
  4. Windows_RTM_RC
  5. c#自制视屏监控
  6. MVC3异常处理的方法
  7. springmvc学习第二天
  8. apache2.4 以上设定gzip压缩
  9. xml 解析 java 基础复习
  10. Web交互设计优化的简易check list
  11. 蓝牙4.0LED灯控方案
  12. 启动Activity时显示空白界面的问题
  13. android File文件的读写操作
  14. html中的div span和frameset框架标签
  15. 使用github管理你的代码
  16. AngularJS进阶(三十七)IE浏览器兼容性后续
  17. js常用的400个特效
  18. Keil的断点调试问题解决
  19. 奇偶数判断2(if else+switch语句)
  20. Linux的crontab应注意事项

热门文章

  1. Python如何像awk一样分割字符串
  2. Safari浏览器对SVG中的&lt;foreignObject&gt;标签支持不友好,渲染容易错位
  3. 8. 字符串转整数 (atoi)
  4. 用Java写一个分布式缓存——缓存淘汰算法
  5. Linux C 用GPS时间更新系统时间的方法。
  6. WeetCode4 —— 二叉树遍历与树型DP
  7. Unity_UIWidgets新手入门
  8. petite-vue和Vue的比较
  9. 图书管理员(NOIP 2017 PJT2)
  10. 插入排序(CSP-J 2021 T2)我有新思路了,链接:https://www.cnblogs.com/wjk53233/p/16533752.html