bradmartin/nativescript-advanced-webview

Feature: provide interface for controlling the advanced webview

Opened this issue · 9 comments

I'm trying to use the advanced webview for an oauth workflow. The problem is that I need programatic access to the webview so that I can close it when the workflow completes. Right now it only allows user interaction to control it.

PS. I'd be happy to collaborate on it.

Also, I can't use the built-in webview because of Google's restricted requirements for OAuth.

Looks like you can close any active activity on Android if you have access to it. Just need to figure that part out. Disclosure: never written a native Android app.

I'll put together a PR.

Poke around here on the android docs: https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent.Builder.html - my quick glance didn't look promising on the API for customtabs - but yea closing the Chrome activity seems reasonable 👍 I wasn't thinking that direction to be honest.

@jonnysamps trying to do something similar (use WebView to login / grab token from WebView then close WebView). How did you end up implementing?

Hello, any progress on this? I think this is a major issue for developers using advanced webview for OAuth authentication flow. Especially in iOS, the plugin should expose e method to closed automatically Safari View Controller after redirect to custom URL.

The way I handle this: from my web app that completes OAuth, I use an x-callback-url that my native app receives. Based on that, I dispatch an event globally to dismiss/close the SafariViewController.