Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: OAuth Flow via Schemes doesn't work in the new version #27

Open
vtjon opened this issue Mar 6, 2018 · 7 comments
Open

Android: OAuth Flow via Schemes doesn't work in the new version #27

vtjon opened this issue Mar 6, 2018 · 7 comments

Comments

@vtjon
Copy link

vtjon commented Mar 6, 2018

In the latest version (2.0.2), it appears that something broke or changed with regards to redirecting to a custom scheme. I use the webview for an OAuth login flow that redirects to a custom scheme that relaunches the app. When this happens, the browser shows ERR_UNKNOWN_URL_SCHEME. There is some discussion here about a similar issue but it's relatively old:
EddyVerbruggen/Custom-URL-scheme#156

I don't have a repo of the issue but there were some errors related to the sandbox. Any ideas what changed in the latest release that could have affected this?

@triniwiz
Copy link
Collaborator

triniwiz commented Mar 6, 2018

@vtjon it opens a webview if if device does not have google chrome installed

@vtjon
Copy link
Author

vtjon commented Mar 6, 2018

I think I got lazy with my wording. I meant Chrome Custom Tabs for the OAuth login flow. It works again when I go back to version 2.0.0. Chrome is installed. I will say, it does look different though like it defaulted to a webview for some reason (i.e., no URL bar or close X). I just tried to open https://www.google.com and it opens in the Chrome version. It must be switching over to a webview during the redirect cycle.

@vtjon
Copy link
Author

vtjon commented Mar 6, 2018

It seems like it worked this time. Maybe I had the old AAR file or something. I will reopen if it happens.

@vtjon vtjon closed this as completed Mar 6, 2018
@vtjon
Copy link
Author

vtjon commented Mar 6, 2018

@triniwiz I think I might have figured out what is going on though I'm not sure exactly why. To recap:

  • I use an OAuth flow that ultimately redirects back to a custom scheme that is supposed to be captured by an intent setup on my app
  • During the OAuth flow, if I have to log into the provider (i.e., Facebook), the redirect works as it did in version 2.0.0.
  • If I am already logged in, the redirects (302) happen without any user interaction. I can see in logcat that the intent is triggered
  • If I restart my app, it will immediately pick up the intent

I think ultimately, my app is being sent to the background. Upon research, I ran across this:
https://stackoverflow.com/a/38494130/62686

I looked at your fancy webview repo and it doesn't appear to call the warmup function. Is this something straightforward to add?

@vtjon vtjon reopened this Mar 6, 2018
@championswimmer
Copy link

I had this similar issue. I set up a fresh webview plugin myself that uses Chrome Custom Tabs. You can try this https://www.npmjs.com/package/nativescript-awesome-webview till the issue is not fixed on this repo

@triniwiz
Copy link
Collaborator

@vtjon it should it’s set to true in the init

@jdnichollsc
Copy link

@vtjon can you try this other option? https://github.com/proyecto26/nativescript-inappbrowser
Let me know 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants