You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jonathangraci (via GitHub)" <gi...@apache.org> on 2025/04/30 12:24:34 UTC
[D] OAuth connection to system's default browser [cordova]
GitHub user jonathangraci created a discussion: OAuth connection to system's default browser
Hi support,
I need to make an OAuth connection from my app. I managed to implement it using the inappbrowser plugin. The problem is that I would like to open the system's default browser and not the local browser to log in.
Can you help me?
Thanks.
GitHub link: https://github.com/apache/cordova/discussions/540
----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscribe@cordova.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [D] OAuth connection to system's default browser [cordova]
Posted by "breautek (via GitHub)" <gi...@apache.org>.
GitHub user breautek edited a comment on the discussion: OAuth connection to system's default browser
To answer your question, In app browser's target attribute controls where to open the URL inside the plugin's [open](https://github.com/apache/cordova-plugin-inappbrowser?tab=readme-ov-file#cordovainappbrowseropen) api. In this case you'd want the `_system` target.
> 
But I think it's worth noting that when using the system browser, inter-communications with the in-app-browser view is limited, you wouldn't be able to pull access tokens. Listener events are only available for `_blank` targets as [noted here](https://github.com/apache/cordova-plugin-inappbrowser?tab=readme-ov-file#inappbrowseraddeventlistener), which means you can't post messages to and from the browser back to your app.
I'm not an oauth expert, nor do I use any oauth flow in my apps but I do know that most OAuth implementators block webviews because app hosts can manipulate the login screen which makes them untrustworthy. (Which is why I assume you're trying to use the system web browser). But because you can't pull out acccess tokens, I'm not sure how far the system web browser will get you for oauth integration.
You may need a native oath implementation that implements the android (and/or ios) oath flows exposed by a cordova plugin to get an oauth flow properly integrated in your app, instead of relying on web-based oauth flows which are intended to only work in traditional web environments that can be relatively trusted by the vendor.
EDIT: See https://github.com/apache/cordova/discussions/540#discussioncomment-13000355 for how passing tokens is done when using the system browser.
GitHub link: https://github.com/apache/cordova/discussions/540#discussioncomment-12992963
----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscribe@cordova.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [D] OAuth connection to system's default browser [cordova]
Posted by "breautek (via GitHub)" <gi...@apache.org>.
GitHub user breautek added a comment to the discussion: OAuth connection to system's default browser
To answer your question, In app browser's target attribute controls where to open the URL inside the plugin's [open](https://github.com/apache/cordova-plugin-inappbrowser?tab=readme-ov-file#cordovainappbrowseropen) api. In this case you'd want the `_system` target.
> 
But I think it's worth noting that when using the system browser, inter-communications with the in-app-browser view is limited, you wouldn't be able to pull access tokens. Listener events are only available for `_blank` targets as [noted here](https://github.com/apache/cordova-plugin-inappbrowser?tab=readme-ov-file#inappbrowseraddeventlistener), which means you can't post messages to and from the browser back to your app.
I'm not an oauth expert, nor do I use any oauth flow in my apps but I do know that most OAuth implementators block webviews because app hosts can manipulate the login screen which makes them untrustworthy. (Which is why I assume you're trying to use the system web browser). But because you can't pull out acccess tokens, I'm not sure how far the system web browser will get you for oauth integration.
You may need a native oath implementation that implements the android (and/or ios) oath flows exposed by a cordova plugin to get an oauth flow properly integrated in your app, instead of relying on web-based oauth flows which are intended to only work in traditional web environments that can be relatively trusted by the vendor.
GitHub link: https://github.com/apache/cordova/discussions/540#discussioncomment-12992963
----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscribe@cordova.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [D] OAuth connection to system's default browser [cordova]
Posted by "jonathangraci (via GitHub)" <gi...@apache.org>.
GitHub user jonathangraci added a comment to the discussion: OAuth connection to system's default browser
Exactly. The complexity is to reopen my app after OAUTH authentication is finished on the system browser.
How can I implement custom URL scheme? Is there a proven plugin?
Thanks.
GitHub link: https://github.com/apache/cordova/discussions/540#discussioncomment-13036386
----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscribe@cordova.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [D] OAuth connection to system's default browser [cordova]
Posted by "BigBalli (via GitHub)" <gi...@apache.org>.
GitHub user BigBalli added a comment to the discussion: OAuth connection to system's default browser
If you want to use the system browser, you will need to use a provider that allows you to specify your own callback redirect URL then use a custom url scheme to get the token (ie re-open the app after login with the token passed).
GitHub link: https://github.com/apache/cordova/discussions/540#discussioncomment-13000355
----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscribe@cordova.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org