# oauth2 **Repository Path**: okhurley/oauth2 ## Basic Information - **Project Name**: oauth2 - **Description**: 搭建一个微服务oauth2.0认证授权服务器 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 2 - **Created**: 2020-05-07 - **Last Updated**: 2024-02-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # oauth2,搭建一个微服务认证授权服务器 使用内存方式存储oauth2中客户端id和客户端秘钥 ![image-1](https://img.204910013.xyz/20221112154420.jpg) (授权码模式) 访问(参数要和代码中的一样) http://localhost:9006/oauth/authorize?client_id=c1&response_type=code&scope=all&redirect_uri=http://www.baidu.com 到登录页面,登录成功后,选择授权 ![image-20200507133559701](https://img.204910013.xyz/20221112154432.jpg) 跳转到百度,code是拿到的授权码 ![image-20200507133111075](https://img.204910013.xyz/20221112155624.jpg) 使用postman,通过code获取token ![image-20200507133834883](https://img.204910013.xyz/20221112154436.jpg) (密码模式) 使用postman访问(参数要和代码中的一样),把authorization_code的参数改为password,同时添加username和password字段 ![image-20200507132718919](https://img.204910013.xyz/20221112154440.jpg)