nativescript-advanced-webview icon indicating copy to clipboard operation
nativescript-advanced-webview copied to clipboard

Feature: provide interface for controlling the advanced webview

Open jonnysamps opened this issue 8 years ago • 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.

jonnysamps avatar Jun 29 '17 18:06 jonnysamps

I'd have to look but I don't recall seeing any native methods on the APIs that allow programmatically closing chrome/safari. Can you look into the native APIs and see if closing them is a method exposed? If not there likely isn't anything we can do. You might be better off with the core webview in nativescript that is exposed.

On Thu, Jun 29, 2017, 1:11 PM Jonathan Samples [email protected] wrote:

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-advanced-webview/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhOID0S7KVkk6KMUSdjlf4V2KQgtoks5sI-jHgaJpZM4OJrUz .

bradmartin avatar Jun 29 '17 18:06 bradmartin

I know iOS has it: https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismissviewcontrolleranimated

Not sure about Android

jonnysamps avatar Jun 29 '17 18:06 jonnysamps

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

jonnysamps avatar Jun 29 '17 18:06 jonnysamps

Gotcha. Well if android has something then that would be a great addition to add. Id like to add more of the options for it I just don't have time right now to do a lot. Can definitely help with questions and PRs :)

On Thu, Jun 29, 2017, 1:40 PM Jonathan Samples [email protected] wrote:

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

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-advanced-webview/issues/17#issuecomment-312061368, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhMQ6Kgnmr6weJOtjfHll1NYwcgOQks5sI--ngaJpZM4OJrUz .

bradmartin avatar Jun 29 '17 18:06 bradmartin

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.

jonnysamps avatar Jun 29 '17 18:06 jonnysamps

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.

bradmartin avatar Jun 29 '17 21:06 bradmartin

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

chrisbellman avatar Sep 11 '17 22:09 chrisbellman

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.

alexmeia avatar May 21 '18 08:05 alexmeia

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.

etelford avatar Jun 29 '19 17:06 etelford