请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

gateway 集成 oauth2 提示Invalid credentials

gateway 集成oauth2 做单点登陆有案例吗 或者思路吗

网关授权,内部裸奔方案

使用gitee 添加了第三方应用;
认证授权都通过了

过程:

  1. 访问http://localhost:8080
  2. 显示gitee登陆界面
  3. 登陆成功后出现授权页面,点击确定后 出现以下错误页面.最下面是日志

项目已上传至github 地址如下:
https://github.com/jiabiaoli/webflux-oauth2.git

页面报错如下图图片描述

以下是debug 日志;

2020-05-14 12:31:26.899 DEBUG 11514 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'spring.liveBeansView.mbeanDomain' in PropertySource 'systemProperties' with value of type String
2020-05-14 12:31:27.036  INFO 11514 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2020-05-14 12:31:27.040  INFO 11514 --- [           main] c.s.itsm.oauth2.Oauth2DemoApplication    : Started Oauth2DemoApplication in 1.704 seconds (JVM running for 2.356)
2020-05-14 12:31:27.506 DEBUG 11514 --- [1)-192.168.1.15] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'local.server.port' in PropertySource 'server.ports' with value of type Integer
2020-05-14 12:31:36.681 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-1] HTTP GET "/"
2020-05-14 12:31:36.739 DEBUG 11514 --- [oundedElastic-1] o.s.w.s.s.DefaultWebSessionManager       : Created new WebSession.
2020-05-14 12:31:36.796 DEBUG 11514 --- [oundedElastic-1] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-05-14 12:31:36.796 DEBUG 11514 --- [oundedElastic-1] .s.u.m.MediaTypeServerWebExchangeMatcher : Processing text/html
2020-05-14 12:31:36.796 DEBUG 11514 --- [oundedElastic-1] .s.u.m.MediaTypeServerWebExchangeMatcher : text/html .isCompatibleWith text/html = true
2020-05-14 12:31:36.797 DEBUG 11514 --- [oundedElastic-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-1] Completed 302 FOUND
2020-05-14 12:31:36.815 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-2] HTTP GET "/oauth2/authorization/demo"
2020-05-14 12:31:36.833 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-2] Completed 302 FOUND
2020-05-14 12:31:36.887 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-3] HTTP GET "/"
2020-05-14 12:31:36.892 DEBUG 11514 --- [ctor-http-nio-2] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-05-14 12:31:36.892 DEBUG 11514 --- [ctor-http-nio-2] .s.u.m.MediaTypeServerWebExchangeMatcher : Processing text/html
2020-05-14 12:31:36.892 DEBUG 11514 --- [ctor-http-nio-2] .s.u.m.MediaTypeServerWebExchangeMatcher : text/html .isCompatibleWith text/html = true
2020-05-14 12:31:36.893 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-3] Completed 302 FOUND
2020-05-14 12:31:36.895 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-4] HTTP GET "/oauth2/authorization/demo"
2020-05-14 12:31:36.896 DEBUG 11514 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [d9bca978-4] Completed 302 FOUND
2020-05-14 12:32:19.784 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-5] HTTP GET "/"
2020-05-14 12:32:19.786 DEBUG 11514 --- [oundedElastic-1] o.s.w.s.s.DefaultWebSessionManager       : Created new WebSession.
2020-05-14 12:32:19.787 DEBUG 11514 --- [oundedElastic-1] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-05-14 12:32:19.788 DEBUG 11514 --- [oundedElastic-1] .s.u.m.MediaTypeServerWebExchangeMatcher : Processing text/html
2020-05-14 12:32:19.788 DEBUG 11514 --- [oundedElastic-1] .s.u.m.MediaTypeServerWebExchangeMatcher : text/html .isCompatibleWith text/html = true
2020-05-14 12:32:19.788 DEBUG 11514 --- [oundedElastic-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-5] Completed 302 FOUND
2020-05-14 12:32:19.792 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-6] HTTP GET "/oauth2/authorization/demo"
2020-05-14 12:32:19.794 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-6] Completed 302 FOUND
2020-05-14 12:32:20.350 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-7] HTTP GET "/"
2020-05-14 12:32:20.353 DEBUG 11514 --- [ctor-http-nio-3] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-05-14 12:32:20.353 DEBUG 11514 --- [ctor-http-nio-3] .s.u.m.MediaTypeServerWebExchangeMatcher : Processing text/html
2020-05-14 12:32:20.353 DEBUG 11514 --- [ctor-http-nio-3] .s.u.m.MediaTypeServerWebExchangeMatcher : text/html .isCompatibleWith text/html = true
2020-05-14 12:32:20.353 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-7] Completed 302 FOUND
2020-05-14 12:32:20.357 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-8] HTTP GET "/oauth2/authorization/demo"
2020-05-14 12:32:20.358 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-8] Completed 302 FOUND
2020-05-14 12:32:23.362 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-9] HTTP GET "/login/oauth2/code/demo?code=f9ec3f3a22179fa2954f075339d5347a8f4c3dd3286da50af7557647f169b75b&state=PgeF-SxuvTI4aSqQGi90sT5h0WM5zx7xsGDADa8enI8%3D"
2020-05-14 12:32:23.400 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.r.f.client.ExchangeFunctions       : [5789ca66] HTTP POST https://gitee.com/oauth/token
2020-05-14 12:32:23.968 DEBUG 11514 --- [ctor-http-nio-5] o.s.http.codec.FormHttpMessageWriter     : [5789ca66] Writing form fields [grant_type, code, redirect_uri] (content masked)
2020-05-14 12:32:24.133 DEBUG 11514 --- [ctor-http-nio-5] o.s.w.r.f.client.ExchangeFunctions       : [5789ca66] Response 200 OK
2020-05-14 12:32:24.178 DEBUG 11514 --- [ctor-http-nio-5] o.s.http.codec.json.Jackson2JsonDecoder  : [5789ca66] Decoded [{access_token=0b44b5e9c6cab1a619d38e59bf33007d, token_type=bearer, expires_in=86400, refresh_token=e (truncated)...]
2020-05-14 12:32:24.189 DEBUG 11514 --- [ctor-http-nio-5] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-9] Completed 302 FOUND
2020-05-14 12:32:24.192 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-10] HTTP GET "/login?error"
2020-05-14 12:32:24.200 DEBUG 11514 --- [ctor-http-nio-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [ca5957ee-10] Completed 200 OK

正在回答 回答被采纳积分+3

2回答

大目 2020-05-14 21:32:48

不太清楚哦 不好意思啦

0 回复 有任何疑惑可以回复我~
提问者 破地瓜 2020-05-14 17:36:26

应该不是客户端代码的问题  将gitee 换成github 就可以   换成gitlab 后反复出现授权页面


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号