xujingfeng

Results 23 comments of xujingfeng

你这个场景不是一般意义的服务间接口调用,我不推荐使用 OAuth2。

@lisl2017 当前页面是否有权利调用对应的接口,应当是由当前登录的用户的 sessionId,取到对应的用户信息+权限,来做判断。浏览器端我一向推崇使用 session + cookie 的机制。如果你一定要使用 OAuth2,可以尝试将 token 理解为 sessionId,保存在 cookie 或者 localStorge 中,不需要考虑 token 泄露的问题。

http://localhost:8080/oauth/token?grant_type=password&scope=select&client_id=client_2&client_secret=123456 该请求有问题,因为你使用了password模式,却没有携带username和password。 http://localhost:8080/oauth/token?username=user_1&password=123456&grant_type=password&scope=select&client_id=client_2&client_secret=123456 该请求应该可以获取到正确响应,确认下你是不是做了什么特殊的配置,我这边自己是可以获得响应的。 {"error":"server_error","error_description":"Internal Server Error"} 可以把详细的error log贴出来

@cel105302 试试不要用 curl,你的请求其实被截断了。我也踩过坑。

@pingalive 看看是不是自己redis服务的问题,redis-cli 可不可以连接上

@huang-xuan 这个是因为你前后的 redis 的序列器不一样造成的问题,可能是不同项目的配置不同,也有可能是同一个项目修改了配置,导致 redis 中的数据无法被正常序列化。

授权码模式的 demo 看来有点问题,不止一个人提了 issue,我最近抽空 debug 看下,调通了回复大家。

@huang-xuan 授权码模式demo已更新,pull 之后重新看下吧