Facebook integration in cross-platform mobile apps - javascript

I am using Parse for JavaScript, and is working with the ionic framework within the Intel XDK.
I am trying to incorporate social media login, where users are able to signin using facebook.
I generally know how to navigate this but my main concern is the following:
I am using facebook for javascript where it requires a URL, and when that URL is not accessible it doesn't work. Hence, on an iphone or android I cant use facebook yet.
The specific error I get is the following:
Warning
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
What have I done as far?
I went over the following guide thoroughly:
http://www.benjamin.my/how-to-set-up-facebook-connect-plugin-and-parse-com-in-ionic-phonegap/
It does mention near the end of the guide that
You may have to add an iOS setting or Android setting too eventually when you deploy to either platform.
and this is the part where I am having issues, and for a while.

Have you set <access origin="*" /> in your config.xml so you can access all external domains?
See the cordova whitelist guide for more information on the subject.

Related

Can I use Google Auth 2.0 from any origin?

I develop modal window with React.js, that can be distributed for several sites via some kind of web application market.
So I faced the issue, that for any website, that would install this extension (btw it's builded to a simple html page + couple of js files, so app will be hosted directly on website of even customer), Google auth error will throw exception of invalid origin.
So is there any way to find a workaround for my case?
btw now I'm using react-google-login library
Google allows you to set multiple URIs. Just take a look in the settings.

can't get facebook login to work on phonegap app using javascript sdk

I created a new facebook app in developers.facebook.com and for the domain i entered my own domain eg www.sarahsexample.com and url http://sarahsexample.com
In my web application I am using the facebook javascript sdk to enable facebook login on my app.
i uploaded my files to my domain www.sarahsexample.com to test it out. it worked perfect.
the actual plan though is to package these files up and build them into a phonegap app. so i tested this out using build.phonegap.com and downloading it to my phone and i get an error from facebook.
so i followed various suggestions that i found on the web. I tried entering http://localhost:8000/ for the url of my app on developers.facebook.com and localhost for the domain. I still get the same error.
So then i found this stackoverflow solution and so i added a platform within my facebook app for android. and I generated firstly a keystore file in command prompt and then a release key hash which i then entered to the key hash place in my app settings on facebook. (my domain and key hash is blurred out for privacy)
in my config.xml file i have this:
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.gxxxxxc.ip_app"
version = "1.0.0">
and also to allow access to all domains i have this:
<access origin="*" />
when using build.phonegap.com i also entered my keystore file here.
i still get the same error. I feel like i've exhausted all possibilities. I've seen this error is very common but any of the solutions i've tried haven't worked. your help is appreciated. thanks

JavaScript API Domain is restricted to localhost phonegap

I am trying to get linked in authentication on my phonegap app so I am using the javascript sdk
What domain do I add to the authentication list? I keep getting the error "JavaScript API Domain is restricted to localhost"
and I tried this: http://www.benwagner.net/mobile/linkedin-developer-api-javascript-domains-cordova-mobile-app/
But linkedin won't allow file:/// anymore
I can see that there seems to be no way to support mobile application Java Script API domain. As the mobile application has no public domain but just a socket, it's a client.
As the link that you have provided claimed to have found a solution in 2013 by just mentioning the protocol file:/// in the domain. However I found another link from 2014 which says that this doesn't work anymore. May be you can try adding file:///, http://localhost.
This should in effect (if the file:/// is allowed) should allow your application on mobile and in localhost browser to sign in.

Facebook integration using Phonegap

I'm using Phonegap 2.3 and Android for developing my app. I'm trying to integrate Facebook login in my app. I had used the plugin available in GitHub. I had integrated the plugin successfully, but when trying to login using facebook login i'm getting error as
Given URL is not allowed by the Application configuration.: One or
more of the given URLs is not allowed by the App's settings. It must
match the Website URL or Canvas URL, or the domain must be a subdomain
of one of the App's domains.
Please suggest some ideas for fixing the bug.

Google+ Sign in from Javascript - Invalid Parameter value for origin

I've been going through the steps to add a Google+ Sign-in to my web application as found in https://developers.google.com/+/web/signin/
When used in a 'typical' web site, the 'client side' flow works just fine. Now, I'm trying to integrate this Google+ sign inside PhoneGap. Since PhoneGap runs the web page as a file:// URL, the origin that gets sent in the request is file://. In every other PhoneGap I've written, this hasn't been a problem.
However, when I click the Google+ sign in button from my page in PhoneGap, the origin being sent as file:// causes the following error message:
Error: invalid_request
Invalid parameter value for origin: Missing authority: file://
I went to the Google API console and tried to assign file:// as an authorized Javascript origin. But, of course, it doesn't allow file:// to be entered as an origin.
So I'm wondering if anyone has any insight in how to do this kind of web-style (Javascript) Google+ sign in from within PhoneGap (or from a local web page where there is no server - just a page being run as a file://). I really don't want to have to do the sign-in in native code and then integrate the token back over into the 'PhoneGap' realm since that kind of defeats the purpose of writing the app once for multiple platforms.
My understanding is that you cannot use the standard client-side flow with Cordova/PhoneGap because file:// is not a valid origin.
However, you can use the In-App Browser plugin along with window.open, which will allow to initiate a "standard" client-side flow from within the application. You then listen to events on the opened window to deal with the responses.
The plugin works cross-platform so you won't have to maintain multiple native implementations.
The ng-cordova-oauth library implements this for AngularJS.
For more details about the implementation, see this tutorial for details, as well as the Google OAuth documentation.
For file://, the thing works differently.. try this as your origin: http://localhost:4567
or try this tutorial: here

Categories

Resources