WebApp Facebook Cordova - javascript

When I start a local Webserver with my WebApp and I login to facebook it works, also when I connect from a mobile device via the browser.
But when I convert my WebApp to a Android Application via Cordova. I get the following message from facebook:
Can't Load URL: The domain of this URL isn't included in the app's
domains. To be able to load this URL, add all domains and subdomains
of your app to the App Domains field in your app settings.
But my question is, what should I enter in the App-Domain? (I already entered localhost)

Related

Chrome opens PWA automatically when opening the site

I have a web application that can be installed as PWA. Once installed the problem appears on Android devices with Chrome.
If a user is logged out the application will redirect to an authentication service that is hosted on a separate server. Once a user has logged in the application redirect him to main page of app. PWA is opened automatically at this point. I don't want this.
Does anybody know a way to prevent automatically opening PWA when a user open a site in browser?
It was noticed on Android 8.0 with Google Chrome 74.0.3729.157.
Also if an authentication page is rendered inside iframe PWA is not opened automatically.
Finally I get it.
PWA is installed as WebAPK so Android open my application automatically when an auth server returns redirect to my application https://developers.google.com/web/fundamentals/integration/webapks.
A way exists to prevent that by defining a scope parameter in manifest.json. But it is not my case because all my application is in the root.
Finally I use iframe to render an auth page instead of redirection to auth service directly.

What "SITE URL" a FB app should have for a hybrid mobile app?

I have an application that needs to be exported for iPhone and Android. This app has a option: Connect with Facebook.
So, I've created a FB app and in the settings is an input that requests the SITE URL. Since my app is a hybrid app, I don't have any site url. I've tried with http://localhost, but it dones't work.
My guess is that I need to make the login with a backend services, but I don't know how, or what is the API for javascript to connect with...Any ideas?
You have to use site URL only if you have a web App. If your App is only iPhone and Android you have to remove "Website" platform from your App settings and add iPhone and Android platform

Can you communicate to a native mobile app from mobile web browser?

I want to find a way to run native mobile app, from a web app on a browser, and communicate the result back to it.
For example, how does Facebook user authentication work on a mobile device? You go to login with Facebook on a website. If on mobile, it opens the native Facebook app to do the authentication, and redirects the user back to the mobile web browser to open some page, post-authentication. Somehow, web browser and native application are able to communicate? Is there also any security risk to this?
One way to do this is as follows:
Use a custom url to launch the app from the website (see link below)
Pass whatever parameters you need to the app (for example a return web site URL in the case of a login authentication type app)
Once the app launches and does it thing, have the app launch a browser using the return address URL you passed as a parameter to the app.
A good, well maintained, link to using custom URL's and passing partakers to the App:
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

dropbox.js auth firefox os

I'm currently developing a Firefox OS app wich should be caplable of saving files into my Dropbox account but I have some problems with the oauth2 authentication process. My app has to be "privileged", which means that all documents are not hosted on a webserver and so I need to use the "Dropbox.AuthDriver.Popup" driver for the authentication process.
My problem:
Everything works fine until Dropbox redirects me to the "oauth_receiver.html" which is hosted on my webserver. It seems that the " Dropbox.AuthDriver.Popup.oauthReceiver();" method can't send the authtoken to my app.
So is it possible to perfom a dropbox.js oauth2 authentication with the built-in auth drivers? Or do I need to do it by hand?
I was able to login to dropbox from a Firefox OS App using:
https://github.com/smarx/othw/tree/master/JavaScript
I did make a few changes. For example getting the redirect url. I changed it to the dropbox home:
function get_redirect_uri() {
return "https://www.dropbox.com/home";
}
I then used the redirects manifest (manifest.webapp for my app) setting like:
"redirects": [
{"from": "https://www.dropbox.com/home",
"to": "/redirects/auth.html"}
]
https://developer.mozilla.org/en-US/Apps/Build/Manifest#redirects
App had to be privileged btw. May not be the best way of doing it but it appears to work.
I also moved the js from inline to an external js file which I executed when a button was clicked. The auth.html file should have access to the token after the redirect.

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.

Categories

Resources