- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 ionic/cordova 构建一个 Android 和 iOS 应用程序:ionic 版本是:4.11.0 & Cordova 版本是:8.1.2
我创建了该应用程序并在 chrome 浏览器中进行了测试,整个应用程序运行良好,包括授权、获取数据等。
当我创建要测试的 Android 应用程序时,我的问题就开始了。无论我做什么,我都无法获得重定向到应用程序的授权工作流程。
这是我尝试过的:
1- 无论我在 config.xml、cordova web View 插件和 cordova 自定义 url 方案插件中尝试什么,回调“http/localhost”都会拒绝连接。
2- 回调“myapp://callback”给出了 err_unkown_url_schema”,无论我尝试修改 config.xml 并使用上面相同的 cordova 插件。
我正在 LGG6 Android 版本 8.0.0 上进行测试。尚未在 iOS 上进行测试。
代码片段:
var uniqueWindowId = 'authorization-' + this.client_id
var params = 'titlebar=no, location=yes'
var loginWindow = window.open(this.authCodeURL, uniqueWindowId, params);
loginWindow.addEventListener(
'message',
e => {
var oauthMessage = e.data;
alert(oauthMessage);
loginWindow.close();
loginWindow.opener.postMessage(oauthMessage, 'https://localhost/');
},
false
);
这是通过 Android Studio 来自设备的日志
Connecting to io.ionic.starter
Connected to the target VM, address: 'localhost:8600', transport: 'socket'
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/zygote64: Late-enabling -Xcheck:jni
W/ActivityThread: Application io.ionic.starter is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/zygote64: Debugger is active
I/System.out: Debugger has connected
waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1419)
I/InstantRun: starting instant run server: is main process
I/CordovaLog: Changing log level to DEBUG(3)
I/CordovaActivity: Apache Cordova native platform version 7.1.4 is starting
D/CordovaActivity: CordovaActivity.onCreate()
I/WebViewFactory: Loading com.android.chrome version 72.0.3626.121 (code 362612152)
I/cr_LibraryLoader: Time to load native libraries: 7 ms (timestamps 8989-8996)
I/chromium: [INFO:library_loader_hooks.cc(42)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number "72.0.3626.121", actual native library version number "72.0.3626.121"
W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
W/ResourceType: Failure getting entry for 0x7f120538 (t=17 e=1336) (error -2147483647)
D/IonicWebViewEngine: Ionic Web View Engine Starting Right Up 1...
D/PhoneWindow: windowLightStatusBar : false, disable View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
D/SystemWebViewEngine: CordovaWebView is running on device made by: LGE
D/PluginManager: init()
D/PhoneWindow: windowLightStatusBar : false, disable View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
D/OpenGLRenderer: HWUI GL Pipeline
D/BezellessGripSuppressionFilter: getdisplaysize, x : 1440 y : 2880
D/PhoneWindow: windowLightStatusBar : false, disable View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
I/zygote64: Do partial code cache collection, code=28KB, data=25KB
I/zygote64: After code cache collection, code=27KB, data=25KB
Increasing code cache capacity to 128KB
D/BezellessGripSuppressionFilter: getdisplaysize, x : 1440 y : 2880
D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)
I/AudioManagerEx: AudioManagerEx created
W/cr_media: Requires BLUETOOTH permission
D/CordovaActivity: Started the activity.
I/Adreno: QUALCOMM build : 14c0496, Ida6448821d
Build Date : 01/08/18
OpenGL ES Shader Compiler Version: EV031.22.00.01
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.6.5.R1.08.00.00.312.043
Remote Branch : NONE
Reconstruct Branch : NOTHING
D/CordovaActivity: Resumed the activity.
I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8996.so from the current namespace instead.
D/BezellessGripSuppressionFilter: getdisplaysize, x : 1440 y : 2880
I/Adreno: PFP: 0x005ff087, ME: 0x005ff063
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
W/AudioCapabilities: Unsupported mime audio/x-lg-alac
W/AudioCapabilities: Unsupported mime audio/x-lg-flac
W/AudioCapabilities: Unsupported mime audio/adpcm
W/AudioCapabilities: Unsupported mime audio/g726
W/AudioCapabilities: Unsupported mime audio/lg-wma-voice
W/AudioCapabilities: Unsupported mime audio/x-lg-ms-wma
W/VideoCapabilities: Unsupported mime video/mjpg
W/VideoCapabilities: Unsupported mime video/theora
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
Unrecognized profile 2130706434 for video/avc
I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8996.so from the current namespace instead.
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
Unrecognized profile 2130706434 for video/avc
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
W/VideoCapabilities: Unrecognized profile 2130706434 for video/avc
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@fdd775d time:801221046
W/VideoCapabilities: Unsupported mime video/dolby-vision
W/VideoCapabilities: Unsupported mime video/dolby-vision
W/VideoCapabilities: Unsupported mime video/mp4v-esdp
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
W/cr_CrashFileManager: /data/user/0/io.ionic.starter/cache/WebView/Crash Reports does not exist or is not a directory
D/CordovaWebViewImpl: onPageDidNavigate(file:///android_asset/www/index.html)
D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
D/SERVER: Handling local request: http://localhost/
D/CordovaWebViewImpl: onPageDidNavigate(http://localhost/)
D/SERVER: Handling local request: http://localhost/cordova.js
D/SERVER: Handling local request: http://localhost/build/main.css
D/SERVER: Handling local request: http://localhost/build/polyfills.js
D/SERVER: Handling local request: http://localhost/build/vendor.js
D/SERVER: Handling local request: http://localhost/build/main.js
D/JsMessageQueue: Set native->JS mode to EvalBridgeMode
D/SERVER: Handling local request: http://localhost/cordova_plugins.js
D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-device/www/device.js
D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js
D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-keyboard/www/android/keyboard.js
D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-webview/src/www/util.js
D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-splashscreen/www/splashscreen.js
I/zygote64: Do partial code cache collection, code=61KB, data=56KB
After code cache collection, code=61KB, data=56KB
Increasing code cache capacity to 256KB
D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-statusbar/www/statusbar.js
D/SERVER: Handling local request: http://localhost/plugins/cordova-sqlite-storage/www/SQLitePlugin.js
D/SystemWebChromeClient: http://localhost/build/vendor.js: Line 4325 : Angular is running in the development mode. Call enableProdMode() to enable the production mode.
I/chromium: [INFO:CONSOLE(4325)] "Angular is running in the development mode. Call enableProdMode() to enable the production mode.", source: http://localhost/build/vendor.js (4325)
D/SystemWebChromeClient: http://localhost/build/main.js: Line 998 : ################################################################################ home.ts constructor
I/chromium: [INFO:CONSOLE(998)] "################################################################################ home.ts constructor", source: http://localhost/build/main.js (998)
D/SERVER: Handling local request: http://localhost/assets/icon/icon.png
D/SERVER: Handling local request: http://localhost/assets/fonts/ionicons.woff2?v=3.0.0-alpha.3
D/SERVER: Handling local request: http://localhost/assets/fonts/roboto-medium.woff2
D/SERVER: Handling local request: http://localhost/assets/fonts/roboto-regular.woff2
D/SystemWebChromeClient: http://localhost/build/vendor.js: Line 140284 : Ionic Native: deviceready event fired after 1716 ms
I/chromium: [INFO:CONSOLE(140284)] "Ionic Native: deviceready event fired after 1716 ms", source: http://localhost/build/vendor.js (140284)
I/App: WARNING: Back Button Default Behavior will be overridden. The backbutton event will be fired!
D/CordovaWebViewImpl: onPageFinished(http://localhost/)
D/SERVER: Handling local request: http://localhost/assets/icon/favicon.ico
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/zygote64: Compiler allocated 6MB to compile void android.view.ViewRootImpl.performTraversals()
I/zygote64: Do full code cache collection, code=123KB, data=107KB
I/zygote64: After code cache collection, code=94KB, data=64KB
D/InAppBrowser: target = _self
D/InAppBrowser: in self
D/InAppBrowser: isUrlWhiteListed [class java.lang.String]
D/InAppBrowser: loading in InAppBrowser
D/PhoneWindow: windowLightStatusBar : false, disable View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
D/BezellessGripSuppressionFilter: getdisplaysize, x : 1440 y : 2880
I/zygote64: Do partial code cache collection, code=118KB, data=94KB
After code cache collection, code=118KB, data=94KB
Increasing code cache capacity to 512KB
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
I/AssistStructure: Flattened final assist data: 520 bytes, containing 1 windows, 2 views
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
我在屏幕上得到的消息是:
the webpage at http://localhost/?code=......@state=..... could nopt be loaded becuase:
net::ERR_CONNECTION_REFUSED
最佳答案
如果您通过应用程序外部的 url 进行 oauth,我建议使用 inappbrowser ionic native 插件。
https://ionicframework.com/docs/native/in-app-browser/
你试过吗?一般来说,这种使用 inapp 浏览器作为 oauth 的方法正在成为一种反模式,随着 Ionic Capacitor 的发展,他们没有使用 inappbrowser,而是围绕适用于 iOS 的 SafariViewController 和适用于 Android 的 Chrome 自定义选项卡实现了一个解决方案,但这仍然非常在我看来,很多都处于测试阶段。
https://capacitor.ionicframework.com/docs/apis/browser/
这是一篇关于使用 inappbrowser 的 OAuth 的过时文章,但它很好地涵盖了插件的基本使用:
关于它为何成为反模式的文章: https://medium.com/@jlchereau/stop-using-inappbrowser-for-your-cordova-phonegap-oauth-flow-a806b61a2dc5
就您的具体问题而言,我也会检查控制台日志,并确保这不是 CORS 问题,还要检查您的白名单以在 config.xml 中进行导航。
关于cordova - Ionic 4 oauth 重定向连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55112231/
我只想允许一个国家/地区访问,但排除该国家/地区内的代理。 这就是我所拥有的(为了方便起见,缩短了版本) order deny,allow deny from all allow from 139.
这个问题在这里已经有了答案: What is an unhandled promise rejection? (9 个回答) 关闭 4 年前。 我目前正在尝试实现我自己的 Promise,以便在 A
我在使用 Gitolite 推送 git 时遇到问题。 当我尝试这个时: git push origin :refs/tags/deployment 我收到这个错误: remote: D NAME/i
我已经为我的 laravel 5.0-dev 项目配置了 mysql,如下所示: 'mysql' => [ 'driver' => 'mysql', 'host' =>
我对 Web 和 SOF 进行了一些研究,但发现对于该错误没有任何真正的帮助。 我使用 Windows 10 Ubuntu Bash 安装了 Node 和 Puppeteer,但未能使其工作,但我设法
在我的应用审核期间,我收到了以下信息: “17.2:要求用户共享个人信息(例如电子邮件地址和生日)才能正常运行的应用将被拒绝 具体来说,您的应用仅使用Facebook登录名进行身份验证,但不包括该网站
我正在开发 VeriFone VX 终端的接口(interface)。虽然,这确实是一个普遍的 EMV 问题。我们的处理器的下限为零,因此它将始终在线发送。但是,如果它发生变化,您如何知道(哪些标签)
我编写了一些宏代码,根据表单提交向经理发送电子邮件(用于费用/审批流程),这是我使用谷歌表单/电子表格的第一个项目,所以也许我可能会错过一些简单的东西,但我为此浏览了 2 个教程,我的代码与重要的部分
clang 3.4 接受以下代码;而 vc++ NOV 2013 CTP 拒绝它并出现错误: error C2668: 'AreEqual' : ambiguous call to overloade
使用 nginx,您可以允许和拒绝范围和 ips (https://www.nginx.com/resources/admin-guide/restricting-access/)。使用realip模
官方编辑: 非常感谢您的帮助,但我仍然遇到问题。 我的 ffserver.conf 文件是这样的: # Port on which the server is listening. You must
我有一个问题:我是 Ubuntu 系统的根。我想授予用户(比如用户名是 X)执行任何命令的权限,但同时我有一个文件夹,除了我的用户(当然不是 X,因为它是 Admin ) 或根。有什么建议么?谢谢!
我使用 Apache2.2 作为 tomcat 服务器的前端。我想限制对某个位置的访问,但允许对子位置的所有访问,但遇到了一些麻烦。 我目前拥有的是: AllowOverride None
就像 this person ,我一直在为浏览器缓存 SSL session 而苦苦挣扎。简而言之,如果选择了客户端证书,则无法以编程方式清除状态,除非在 IE 中使用 document.execCo
我的网站是在由 Apache 服务器提供服务的 Angular 上设置的。我通过 View 将内容动态加载到主页上。 现在以下是我的问题: 我建立这个网站的主要目的是通过 google adsense
我最近遇到了我的应用程序的问题,当它突然被 Google Play 拒绝时因为他们发现我使用的是背景位置 .但实际上我并没有使用这个功能。我只有 ACCESS_COARSE_LOCATION和 ACC
function sendPushNotification(subscription, urlEncodedData){ try { webpush.sendNotification(su
我包裹了一个 request-promise-native调用返回 promise 的函数。 import request from 'request-promise-native'; functio
我正在开发我的 meteor 项目,并开始设置我的第一个更复杂的允许/拒绝规则。我发现很难看出哪些允许触发,哪些不允许触发,以及这些函数中的某些变量包含什么。例如: List.allow({ u
我正在 AngularJS 中创建一个 Factory,它是这样的: if (href) { return $http({ method: method, url: item.href });
我是一名优秀的程序员,十分优秀!