# sharelife **Repository Path**: axuan4j/sharelife ## Basic Information - **Project Name**: sharelife - **Description**: Share Lift project - **Primary Language**: Java - **License**: Not specified - **Default Branch**: dev - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-07 - **Last Updated**: 2021-02-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## KeepLife - 轻社区 * 设计图 ![](https://gitee.com/wuxuan0215/sharelife/raw/master/other/design.jpg) #### OAUTH2-授权码模式 ##### 获取code * GET /oauth/authorize?client_id=life&response_type=code&redirect_uri=https://www.baidu.com&scope=all ##### 兑换token * POST /oauth/token?client_id=life&grant_type=authorization_code&redirect_uri=https://www.baidu.com&scope=all&code=${code}&client_secret=life #### OAUTH2-密码模式 * POST /oauth/token?grant_type=password&client_id=life&client_secret=life&username=user_1&password=123456 #### 检查Token以及获取user信息 * GET /oauth/check_token?token=${token} #### token三种用法 1. rest请求 拼接参数?access_token=${token} 2. 请求头 Authorization: bearer ${token} 3. 表单参数(不建议) #### Token数据结构 ``` {"access_token":"d449874f-9088-4497-be63-5aa95aadf518","token_type":"bearer","refresh_token":"6b1bc4fd-ba42-4135-90d7-5d0fee10fef1","expires_in":7199,"scope":"all"} ``` #### check_token/user_info的返回数据 ``` {"aud":["life-resource"],"user_name":"xwu36","scope":["all"],"active":true,"exp":1605895443,"authorities":["ROLE_OW"],"client_id":"life"} ```