oauth2+spring security前后端调用流程

端口号说明:

6001:网关

8001:业务服务端口

注 401:没有携带token(需要跳转)

    402:认证失败,无效或过期token(需要跳转)

    403:权限不足 不能访问接口(将信息显示前天)

登录所需接口

1登录接口(因为没有指定认证后跳转的路径 此接口不能单独使用)

http://localhost:6001/authentication/login

请求方式post

参数:username

扫描二维码关注公众号,回复: 12471700 查看本文章

密码:password

验证码:code

2 获取code

http://localhost:6001/authentication/oauth/authorize?client_id=user-vue&response_type=code

请求方式 get

参数:client_id(为后台指定给前台客户端名称)

可以跳转到http://localhost:6001/authentication/loginPage

然后拿到code

3.获取token

http://localhost:6001/authentication/oauth/token

请求方式:post

参数:grant_type :authorization_code(指定为授权码模式)

          code: 上接口获取的code码

备注:需要带上Authorization

账号:user-vue

密码:1234

grant_type:指定模式 code上面拿到的code

4.退出登录

http://localhost:6001/authentication/oauth/logout

请求方式:post

参数:access_token:获取的token

5.验证token

http://localhost:6001/authentication/oauth/check_token

请求方式:post

请求参数:token:获取的token

备注:需要带上Authorization

账号:user-vue

密码:1234

猜你喜欢

转载自blog.csdn.net/qq_20143059/article/details/113395887