Is there anyway to integrate facebook into a Unity desktop application? - macos

I'm developing a Unity's cross-platform application (Win, macOS, Android, iOs) and I wanted to include a facebook login so users could sign up via Facebook. I've already been able to do it in Android and iOS platforms through the following link:
https://developers.facebook.com/docs/unity/gettingstarted
This method doesn't work for standalone desktop platforms. I've been looking for a solution to the problem, but I haven't found anything.
Does anyone know a solution or a plugin for Unity that can include Facebook Login for Desktop Standalone platforms?

Facebook still does not have any way to use its official SDK in Standalone builds (it's 2019 now, and posts requesting that feature can be seen dated as far as 2013...)
The options (as of now) are:
1. Manually build Facebook login flow
(that requires server-side support and opening a webpage outside of Unity) - see here:
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/
Pros:
Cheapest option if you can self-host executables
Good start option
Some major gamedev companies went for such solution (even Blizzard!)
Cons:
You will need to minimalize Unity game to log-in
Requires some time to code and test properly
Note:
Tested in one of my own games;
2. Use third-party provider
(like Google's Firebase)
Pros:
You have it up and running in matter of minutes
You can integrate other login methods
Cons:
You are locked in with that provider
It costs you on per-user base
Note:
Also tested in some other of my games;
There are several urban legends that Firebase is way more costly then it promises; See here ("How we spent 30k USD in Firebase in less than 72 hours") and here ("Unexpected monthly bill of more than 1.000€")
3. Embed Chromium directly into Unity, use in-browser authentication
You will need either free and open software chromium framework (here or here), or if you need premium support - this plugin.
Then you must follow this tutorial:
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/
But this time - using embedded browser, which does not requires external server.
Pros:
No recurring paymants
Does not take your users away from your game
Cons:
This is treated as new browser for user; Cookies, stored session, etc. will not be available
Let me stress that out again: users will have to explicitly login to Facebook, without their favorite password managers
Still need some time to code and test propertly
Note:
I did NOT throughtly tested that. Use at your own risk - I would actually recomend either 1. or 2.

Related

App Development - Finding the right platform to migrate to from an existing infrastructure

We have an existing cross-platform Mobile Application, that also has an accompanying web application, that uses AWS as a back end (RDS for Database, Four server instances, and a Load Balancer to distribute traffic). APK and IPA files are packaged and sent to the stores, while components are retrieved from our server per request, which enables us to reduce the number of store builds, and make the process easier for getting changes out to clients.
We are at the stage of Development that we need to move to another platform to better facilitate our fast growing client base.
Due to the conditions upon our clients, these things must be considered.
must be cross platform (Android / iOS).
must be offline based (users need to be able to access without an internet connection)
must be able to sync with an existing database when there is a connection
requires Authentication
Cloud based (? may not be the right term, but meaning the ability for us to store components on a server and have a device check for updates and download a local copy - enabling us to work and distribute fixes faster)
Ideally compatible with AWS
We are currently looking at Xamarin to facilitate us for this move, however there is a lot of documentation and plugins out there to do all sorts of different things.
As developers, we all have some .net / c# experience, however none particularly with Xamarin.
We have a particular timeline that we need to adhere to (and need to ramp up in the next couple of weeks), and right now are essentially stuck in Limbo in a research phase, as we can't afford to get some things right. We are unable to move forward until we know Xamarin (or some other framework) is able to do everything that we need it to do.
It's hard to escape from the 'code it all ourselves' mentality - especially as we don't know where to start looking in terms of third party packages for Xamarin, and their documentation itself.
A lot of documentation mentions various systems of Azure - we would not be against moving to Azure over AWS if it _had to be done*, but because of the existing infrastructure with AWS - staying with AWS is obviously the preferred option (users need to access the current system whilst we build the new system)
This stack overflow post is to ask for recommendations, comments, or other observations on anything and everything involved with the process in regards to choosing frameworks, design patterns, methodologies, third party packages, etc.
Obviously we would like to use best practises for everything moving forward for optimum scalability and cleaner, more robust code. It's just hard to know where to start!
Any input will be highly appreciated.
Cheers!
edit: I am aware that this is 'asking for recommendations' which is 'specifically off-topic'. I have read the posting guidelines about open ended discussion, and am quite confident that this case is different. There is an underlying problem here, in that we are seeking advice on combinations of frameworks and plugins that are fully compatible with all of the items in the list (above)
Let's try to breakdown each of your requirement and constraint mentioned in the question.
1. You need a offline first architecture (With Sync mechanism)
Xamarin + Azure would make a good comdo for you, as it would support offline storage out of box (With a simple PullAsync call).
Albeit there are AWS SDK available for Xamarin. Here it goes http://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/setup.html
So the call is yours. There are few other ways to achieve caching offline storage in Xamarin, you can build upon those strategy in your logic. Alternatively there is a very interesting C# library Akavache for caching and offline storage.
2. OAuth 2.0 Authentication
Xamarin has a very good library named Xamarin.Auth. Though I would not say it is very easily extendible at this but there has been some serious work going on from Xamarin on this library.
But I would say it is very easy to use. The apps I have developed so far that includes - Google OAuth, Facebook integration, Microsoft account integration. It worked fine for all of them.
3. Cloud based distribution
There are nice tools available with Microsoft. Which makes the distribution easy. Have a look at https://mobile.azure.com . Also hockeyApp is good for distribution I found.
Where to start:
A very good starting point for you would be https://channel9.msdn.com . Just go there search with keyword "Xamarin" and view some videos. May be all these cross platform dynamics will be much easier for you.
Overall I found Xamarin a cool product to work with. Because anything that can be done in native Objective C/Swift or Java can very well be done in Xamarin using C#.

Convert server-generated site to PhoneGap/Cordova app?

What's the lowest effort way to get a site with server-generated pages (in my case Laravel/PHP) running as a PhoneGap/Cordova app? I'd rather not have to convert the whole thing into a single page app before importing into PhoneGap/Cordova.
Is it possible to use PhoneGap/Cordova as a very thin wrapper and still load each page live from the server? And if so, how exactly please? I don't think we need any native phone APIs.
Reason for the whole thing is my client insists on "having an app" even though obviously our site will work in a mobile web browser and can have an icon on the user's phone.
Many thanks
Unfortunately for your app to pass Apple App store approval it will have to provide some basic functions and display correctly without an internet connection. This means at a minimum, if you plan to generate content on a server you will probably need the Cordova plugin for network information:
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-network-information/
I would make sure you are familiar with the Apple Human Interface Guidelines:
https://developer.apple.com/ios/human-interface-guidelines/overview/design-principles/
You will probably also need to bundle any JavaScript. Apple is very picky about apps that download code (this can include JavaScript).
This is a section from the iOS developer Agreement.
3.3.2 Except as set forth in the next paragraph, an Application may not download or install
executable code. Interpreted code may only be used in an Application if all scripts, code and
interpreters are packaged in the Application and not downloaded. The only exceptions to the
foregoing are scripts and code downloaded and run by Apple's built-in WebKit framework or
JavascriptCore, provided that such scripts and code do not change the primary purpose of the
Application by providing features or functionality that are inconsistent with the intended and
advertised purpose of the Application as submitted to the App Store.
The following is my opinion only
My fear is that if you go at it in a low effort way, best case you will fail app approval. Worst case it will leave users with a poor experience or worse, a poor image of your client. Do it properly and give the app some extra functions that you can't have in a browser alone. I would advise your client of this and see if they would like a proper app that engages their customers and provides them with a great experience.

How I apply review to get publish_actions permission for a Windows application written in Win API/C++?

I created and used application softwares(exe file written in C++ with Win SDK) of Windows OS(Win7) which has a function to upload(post) user photos to Facebook. They were working fine but now it is not possible to post photos to Facebook and I got to know I need get my application reviewd for public_actions permission. I tried to do it but could not find way to submit since there's no category for Windows application. How can I do it? I think the reviewers need to 'run' the app and it looks OK for andriod, iOS, Win8 apps, and Web site since reviewers can access to them by codes or URL for the apps but I have no idea how to make it for my Windows application. It is big size application with lots of images over 1Gbytes. Will it be OK to use an FTP account for the reviewers to download and review it?
In your review notes you can explicitly mention that this is a Windows application. You will need to provide as much screenshots as possible or preferably, a screencast where you show how you use the Facebook integration.
To get all the required fields, you can fill in the website for your application (if you have one) or an other website. Just make sure to mention that in your reviewer notes.
That should work with getting your app reviews.
ps: this question actually is not appropriate for Stackoverflow. I suggested using the Facebook Developer Community group for these kind of questions (non-technical).

Providing web services through XCode

All,
I'm writing an extensive iPad application with a Core Data based data model. Because the app requires a lot of user input / typing, I would also want to make the functionality available as a web page, so that users can use standard PCs to key in some of the data.
I'm not particularly worried about the UI for that web app, but I do want to re-use the application logic and Core Data model that I'm using for the iOS app, so my preferred approach would be to expose the functionality as web services on a Mac (using the built-in Apache web server, most likely), using XCode for MacOS.
(1) Are there any existing XCode-based frameworks that simplify the generation of web services?
(2) Am I missing something obvious i.e. is there a better approach to tackle the problem "exposing iOS functionality through a web environment"? Obviously, I could've immediately focused on writing the app in HTML5, but I did want to leverage all the goodies that come with iOS/Cocoa.
(3) Alternatively, I could write a native Mac OS app. That facilitates the re-use of Core Data, etc., but I heard it takes a lot of work to port iOS apps to Mac OS. The question then is what's more work - exposing the functionality as web services or porting it to Mac OS... in both cases, I would need to rewrite the UI.
thanks everyone,
Fabian
If you want iPhone/iPad users to be able to access the App through the PC web browser to send data/files to the App then take a look # this one:
http://blogs.oreilly.com/iphone/2008/09/creating-an-iphone-based-web-s.html
Check this question too:
https://apple.stackexchange.com/questions/9012/has-anyone-ever-tried-to-use-an-iphone-as-web-server
I did some more research and came across the WebAppKit framework. It allows you to easily set up a web server capability and handle requests and responses. It's lightweight, easy to understand - exactly what I wanted.

Using the browser for desktop UI

How can I use the browser as a UI for a desktop app? The ways I have come up with so far are...
Use all HTML/Javascript. Problem: Can't access filesystem or just about anything else.
Run a local webserver while the application is in use. Problem: How do I kill it when the user is done? My users are not technical enough to Ctrl+C.
Embed a browser component in a regular GUI. Problem: Embedded browser components tend to be glitchy at best. The support for Javascript/CSS is never as good as it is in a real browser.
...?
The ideal solution would work with any technology. I know there are options like writing Firefox extensions, but I want to have complete freedom in the backend technology and browser independence.
Please note that if you choose to run a local webserver, you're creating a security risk.
Any webpage running on the same machine that knows about your app can send requests to your server using Javascript, and you have no simple and reliable way of knowing what the request came from. (Don't trust the referer header)
Google Desktop, which uses a similar approach, has had several real-world vulnerabilities that allow any webpage to read any file on disk.
There are several ways to protect against this; I would recommend requiring each request to have a auth key which is randomly generated per-machine (and expires at some point), which you could put in the source for the actual pages. XHR protection would prevent malicious websites from reading the auth key, rendering them powerless.
If you are looking for a python Web Server with a Kill link, you could always check CherryPy.
import webbrowser
import cherrypy
import threading
class MyApp:
""" Sample request handler class. """
#cherrypy.expose
def index(self):
return """<html><head><title>An example application</title></head>
<body>
<h1>This is my sample application</h1>
Put the content here...
<hr>
Quit
</body></html>"""
#cherrypy.expose
def exit(self):
raise SystemExit(0)
class MyBGThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.start()
def run(self):
cherrypy.tree.mount(MyApp())
cherrypy.quickstart()
myThread = MyBGThread()
webbrowser.open("http://127.0.0.1:8080")
This code is based on the sample from the SingleClickAndRun on the cherrypy website:
http://tools.cherrypy.org/wiki/SingleClickAndRun
Note than in a normal WebApp you would probably use a templating engine and load templates from methods like main.
Something that would be nice would be to embbed a browser control in a gui window and close the server when the app exits.
For the security, you could possibly add an authentication scheme. There are a few that are supported by cherrypy, but you possibly could implement your own too, using tool modules.
I am looking to do the exact same thing (desktop app that uses an up to date HTML5 / CSS3 browser as the desktop app's GUI), only with Ruby (various reasons why I decided to work with Ruby). Its amazing the number of cross platform libraries people have come up with. But yet, few to no one, has done any work on trying to get a web browser to be a desktop app UI. Cross platform issue... well I won't say solved, but I will say several steps in the right direction taken.
To me this would be perfect with the new HTML5 / CSS3 standards coming out. I know it can be done with a web server running locally.
Another way might be like how the guys from “280 North” are doing what they do. They developed Objective-J (an extension of regular JavaScript that mimics how Objective-C extends regular C) and Cappuccino (the Objective-J equivalent of Objective-C’s Cocoa frame work on the MAC). They also developed “Atlas” which is 280 North’s version of Apple’s “Interface Builder” from Xcode, for their Objective-J and Cappuccino frameworks to build Internet Applications. Atlas is actually a Cappuccino web app running on your desktop as a desktop app. In this case they use the Narwhal… a cross platform, general purpose, JavaScript platform for developing JS apps outside of the browser (basically a specialized web server).
If any one can come up with an idea to make “Browser, direct connect to Desktop App” work without the need of a web server co-existing and still get to manipulate the local FS, I to would be very interested… Hmmm... Now that I think about it, I wonder if the new Google Chrome project “Native Client” can be used to do that. NaCL is much like Active X except you are not limited to a windows platform (but will be limited to the Google Chrome browser, at least for now). Only there is added security via Sandboxing, but you can manipulate the local FS… The more I think about it, the more I am beginning to suspect that it can be done.
Any thoughts?
In Windows, you could embed the IE ActiveX control, which uses the same rendering engine as IE. (That's a plus and a minus) You can set the ScriptObject property in your host code and access it in Javascript as window.external to do things that Javascript cannot do.
If you run a local webserver, you could have an exit link in the app that kills the websever.
You did not mention the OS you will need to target. But you might be able to create a program statared web server, then launced the default browser. Wait until the browser is terminated by the user and then shut down the web server.
So for example on windows you can use CreateProcess() to spawn the process
then MsgWaitForMultipleObjects() to wait until it is finished executing.
HTML Applications (HTA, for short) have been around for a while. You can read all about them here. They are basically HTML and Javascript with some extra options to create a window and with access to the local file system. They seem to be exactly what you want. It is Microsoft technology, so this will only work with IE on Windows systems. I've successfully used this as a front-end for a CD-ROM which was used to distribute software to first year students
Another option would be to use Adobe Air. I'm not all that familiar with the technology, but it seems to provide a framework to deploy web pages as desktop applications. I can't post a second link as a guest, but just google it and you'll find it soon enough.
Today, in 2023, you can simply use any installed web browser as GUI using the WebUI library.

Resources