【发布时间】:2017-03-21 20:05:11
【问题描述】:
我有一个 Ionic 应用程序,它使用 ng_token_auth 和 devise_token_auth 使用 facebook 向我的 rails api 进行身份验证。
项目在使用 ionic serve 执行时运行良好,但是在尝试模拟或从 xcode 运行时,回调失败并出现“权限被拒绝”错误。
我已将其范围缩小到 ios 中的回调 uri 本质上是 file:// 而不是网址。
如何摆脱这种权限违规?我已经尝试在所有键中使用通配符的 cordova-plugin-whitelist 但仍然无法正常工作。
有人有线索吗?快把我逼疯了。
编辑:我的索引文件中有这个:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' file: 'unsafe-inline' data: gap: https://ssl.gstatic.com https://cdn.pubnub.com https://pubnub.github.io https://maps.googleapis.com https://js.maxmind.com https://csi.gstatic.com https://ssl.gstatic.com * 'unsafe-eval'; style-src 'self' file: 'unsafe-inline'; media-src *">
这些暂时在我的 config.xml 中
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
我看到来自 api 的响应
Redirected to file://?auth_token=2NYS8SaPIhydxxuA39IbSA&blank=true&client_id=Qc7GuZ3s6d344L2LkWfuPQ&config=&expiry=1491307425&uid=10152938160630709
然后Xcode中的错误为:
webView:didFailLoadWithError - -1102: You do not have permission to access the requested resource.
干杯
【问题讨论】:
标签: cordova ionic-framework callback rails-api