cordova-plugin-oauth
cordova-plugin-oauth copied to clipboard
Add preference for configurable callback hostname
Hello There, The plugin seems to work correctly alas Facebook does not allow to insert non http(s) URI in allowed redirect URI.
Unfortunately it's not possible to support this on iOS.
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!
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.