我正在构建一个ionic应用程序,并使用ng令牌身份验证。浏览器中的一切都很好,我可以通过Facebook识别,但当我在android上模拟时,我在登录Facebook后出现了一个错误,应用程序正在重定向:
I/chromium( 2252): [INFO:CONSOLE(0)] "Not allowed to load local resource: file:///android_asset/www/index.html?auth_token=kUDlceeLBDmauQ2nN_KzqQ&blank=true&client_id=zoIcXXXXolEkpN0IxM9utA&config=&expiry=1459541228&uid=1727512764150849#/app/signin", source: file:///android_asset/www/index.html#/app/signin (0)
这是我的后端代码:
BASE_API_URL
取决于应用程序是否在本地主机上启动。
$authProvider
.configure({
apiUrl: BASE_API_URL,
storage: 'localStorage',
forceHardRedirect: true,
omniauthWindowType: window.cordova == undefined ? 'sameWindow' : 'inAppBrowser',
authProviderPaths: {
facebook: '/auth/facebook'
}
})
我的config.xml具有inAppBrowser功能。
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser"/>
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser"/>
</feature>
知道吗?它与webview有关吗?还是内容安全策略?我使用InAppBrowser功能,但我怎么能确定它是用启动的?
好的,我解决了。因为omniauthWindowType: window.cordova == undefined ? 'sameWindow' : 'inAppBrowser'
总是使用sameWindow
。