I support an old web application written in C ++ and javascript. I was asked to add login authentication to Facebook, Google and Twitter.
The Facebook key went well. I found simple javascript code on the developer's website http://developers.facebook.com/docs/reference/javascript/ , which I added to my login page. Then I changed the Cgi program to login to C ++ to recognize Facebook callbacks and to log in to the system using my email address (which is already stored in the file).
I am stuck in google cue ball. At first I pounced on Google, but I did not find simple examples. I was directed to the C ++ libpkele library, but I cannot find any instructions on how to use it (and I suspect that this is not what I need). Then I found something called Google Friend Connect http://code.google.com/apis/friendconnect/docs/code.html (which unfortunately says it is depreciating). This contained a good javascript example that I posted on my website. It provides a button that says โSign in,โ and when you click on it, a window appears asking you for an email address. You fill in the address, it says "Connect to your IDP" and then "Redirect to your IDP", then my page appears after a login in a pop-up window.
Obviously, I donโt want this - I want it to appear in the original window, where they clicked the "Login" button.
Here is my javascript from the login page:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/googleapis/0.0.4/googleapis.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/jsapi"></script> <script type="text/javascript"> google.load("identitytoolkit", "1", {packages: ["ac"], language:"en"}); </script> <script type="text/javascript"> $(function() { window.google.identitytoolkit.setConfig({ developerKey: "<I put my developer key here>", companyName: "<I put my company name here>", callbackUrl: "http://www.mywebsite.com/cgi-bin/login.cgi", realm: "", userStatusUrl: "http://http://www.mywebsite.com/cgi-bin/loginstatus.cgi", loginUrl: "http://http://www.mywebsite.com/cgi-bin/login.cgi", signupUrl: "http://http://www.mywebsite.com/cgi-bin/login.cgi", homeUrl: "http://www.mywebsite.com", logoutUrl: "http://http://www.mywebsite.com/cgi-bin/logout.cgi", idps: ["Gmail", "GoogleApps", "Yahoo"], tryFederatedFirst: true, useCachedUserStatus: false }); $("#navbar").accountChooser(); }); </script> <div id="navbar"></div>
I find that my userStatusUrl is never called. CallbackUrl is called, but I'm not sure what to return it. It seems that everything I return is simply displayed on the page. I saw a link passing somewhere to return a json element containing {"registered": true}, but that didn't work either (here is the exact text that I returned from the cgi script):
Content-Type: application/json Content-Length: 20 {"registered" : true}
Any help or pointers to a good simple implementation are appreciated. (A PHP script that uses external libraries would not help!)