Ionic + jHipster + Okta移动应用程序中的CORS错误

时间:2019-07-07 00:42:01

标签: jhipster

我一直在关注Matt Raible教程,以使用jHipster,Ionic和Okta构建移动应用。

https://developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster

但是,每当我尝试从Ionic应用程序登录时,都会遇到CORS问题。 Web应用程序登录完美运行。

我什至尝试克隆并执行git repo中提到的同一组步骤 https://github.com/oktadeveloper/okta-ionic4-jhipster-example

但是它是同样的错误

CORS策略已阻止从来源“ https://dev-xxxxxx.okta.com/oauth2/default/.well-known/openid-configuration”访问“ http://localhost:8100”处的XMLHttpRequest:请求的资源上没有“ Access-Control-Allow-Origin”标头。

登录错误:错误:无法获取服务器配置

enter image description here

我尝试更新src / main / resources / config / application.yml,如以下视频所示 https://www.youtube.com/watch?v=eS6Ti5Ft7JE

我什至尝试了@ oktadev / schematics插件 https://www.npmjs.com/package/@oktadev/schematics

2 个答案:

答案 0 :(得分:0)

我的指令说,在创建本机应用程序时,将http://localhost:8100/implicit/callback添加为重定向URI。在创建应用程序时执行此操作,将为您创建http://localhost:8100的可信来源。如果您在创建应用后更改了重定向URI,则不会创建任何受信任的来源。您找到的解决方案才是真正的解决方案。

答案 1 :(得分:0)

转到您可信任的来源:https://dev-xxxxx-admin.oktapreview.com/admin/access/api/trusted_origins

并确保您有http://localhost:8100作为受信任的来源