cordova-plugin-oauth icon indicating copy to clipboard operation
cordova-plugin-oauth copied to clipboard

Add preference for configurable callback hostname

Open oudoken opened this issue 2 years ago • 3 comments

Hello There, The plugin seems to work correctly alas Facebook does not allow to insert non http(s) URI in allowed redirect URI.

oudoken avatar Sep 02 '22 16:09 oudoken

Unfortunately it's not possible to support this on iOS.

dpogue avatar Sep 07 '22 19:09 dpogue

Hi @dpogue, Sorry to bother again... I've do some more tests.

In the facebook developer (maybe also in others oauth) it's not possible to use custom uri "myapp://" as a valid OAuth uri for the login function.

I've modified the plugin in line 114:

if (uri.getHost().equals("oauth_callback")) {

with:

if (uri.getHost().equals("cct.xxx.xxx")) {

The string "cct.xxx.xxx" in conjuction with the "fbconnect://" oauth uri it's the only allowed way to get back the response.

The best way to implement will be to make the "host" (in this example "cct.xxx.xxx" or the original "oauth_callback") a parameter for the plugin so it will be configurable from the user.

Also the listener event name (line 125) it will be better to be customizable from the user.

Finally the plugin parses ONLY query key (getQueryParameterNames) but in the of facebook also the fragment is used( ie: getFragment() ). It will be usefull to get keys AND fragments (or just return the url as string...).

Btw with this changes the plugin works correctly!

oudoken avatar Sep 08 '22 09:09 oudoken

The fbconnect:// part should already be possible with the existing preference. I'll look into adding a preference for the hostname and returning the full URL to JS.

dpogue avatar Sep 08 '22 15:09 dpogue