JS SDK on localhost - javascript

I can't seem to operate from my localhost. I'm trying to use the FB javascript SDK. My URL is http://localhost:8888. In my App settings I have already defined my site URL as "http://localhost:8888". The domain I specified was "localhost". I'm trying to pull my name using FB.api but it keeps on showing "undefined". I wonder if anyone has this problem too.
I am operating on my Mac, using MAMP.
I've tried not using the SDK. I tried just using client-side validation as described here:
https://developers.facebook.com/docs/authentication/
And it works fine. I am able to display my name. But there's just something up with the SDK I can't figure out.
Help appreciated.

Related

using google APIs within a chrome extension

I'm working on a project to make a chrome extension and the idea is to take notes and write to a Google Doc. So far, for getting started I've created a API key and am using a Client ID (web app option) to work locally using the template from Google's JavaScript quickstart HTML, see source:
https://developers.google.com/docs/api/quickstart/js#python-2.x
I've since been messing around and made some functions and a popup.html that would be used for the extension popup. Now, I'd like to test this within the extension / browser environment and herein lies the issue. I would think you can get access to these APIs within the extension and still test and develop without publishing to the chrome store.
It seems I need a key in the manifest along with an oauth2, client_id, and scope. The latter I have, but I don't get how I can get a key for this? From the developer documentation, it mentions that you can pack your extension and this gave me private key, is that the same thing? I should note too, that the process listed in the documentation doesn't work for me as in my local files the extension isn't in my system.
Moreover, I suspect I need to get the scripts to handle logins and authorize as well, but one step at a time here.

ReactJS Firebase Hosting and Google Search Console

I've just deployed an "alpha" version of my ReactJS SPA using Firebase Hosting, and I've been trying to figure out a way to test SEO using Google Search Console. When I enter the url and click continue, it gives me the TXT record that I'm supposed to "copy into the DNS configuration" for my url. The "url prefix" wants me to upload an html file for verification, but I don't think this is even possible with a single page ReactJS app. I've done quite a bit of searching online, but haven't found a definitive solution. Could somebody please explain the proper way to do this? Thank you.
I know there are different ways to connect your website files to google search console for verification. For me I opted for the older method that didn't need DNS configuration. All you had to do was copy in a meta tag you'll be given

google maps API JavaScript not running in html file but runs in w3schools

I attempted to get my current location and display in google-maps.
for this:
I activated the Javascript API(in google.developers site).
got the key to access the api.
copied the code in the link below to a html file( inserting my key when "calling" the api, of course).
https://developers.google.com/maps/documentation/javascript/examples/map-geolocation
When I ran the html file in the browser, I received an alert giving the error InvalidKeyOrUnauthorizedURL, but it seems that I did everything right, and actually it seems I really did, because when I ran the exact code in the W3Schools tutorials ("Try it your self") the result showed me my location.
So after this context, I would like to know why I can't run this code directly on the browser, I mean, It's kind of OK using the w3schools but it's not the properly way and it's questioning why it's invalid.
observations:
note that the file is not being hosted, it is my own computer.
I tried to run in Opera and Chrome browser- and they both failed.
I ran codes of google maps api successfully directly on the browser but they didn't need any key.
Thanks
It's because you are not hosting it on the local server.
Your browser won't allow location request to go through even if you allow all sites to track your location.
Set up a server on the localhost interface and then try running it. It should work just fine.
PS. Your browser will tell you when any location requests are blocked. In Chrome there will be a small icon on the right hand side of the URL bar after a request for location has been made.

SoundCloud JS Authentication

Ok so i've been pulling my hair out for 2 days over this no doubt simple problem.
I'm using their JS SDK, I have created an app, hosted the callback html file, both redirect_uri fields are correctly populated. When I then call the SC.connect the popup loads, I accept permission... then nothing happens. The popup never closes and my authentication is not returned to the original page. I have done everything as they have said in their developer docs. I have checked out their demo pages which work, I have analysed the code, I have even copied to code exactly and run it on my site, same damn problem. Only thing I can think is that it has something to do with the callback.html file. Am I supposed to put code in there to return back to my site after auth? (if so they kept quiet about this in the docs) I checked out the soundcloud version of the callback.html file, there's contains nothing but a link to the sdk.js file? Which I even tried but no matter what I do I can't seem to get the popup to close after auth.
Any ideas guys?
And yes, I'm fairly new to using apis
In Soundcloud's sample callback.html, the code:
<body onload="window.opener.setTimeout(window.opener.SC.connectCallback, 1)">
must be altered to:
<body onload="window.setTimeout(window.opener.SC.connectCallback, 1)">
This allows the popup to close properly and completes the login flow for the client side javascript SDK. Application settings must be correctly configured to the same domain (localhost or production, but not a mix of the two).

Return to application when email sent - iOS Javascript Apache Cordova Mailto

I have managed to send an email easily by using "mailto". Here is an example of my code:
window.location='mailto:test#email.co.uk?subject=Order Acknowledgement&body='+ " confirming";
The problem im having is that when I click send in outlook on the iPad, it doesnt go back to my application. I understand why this may not be possible but has anyone got any ideas? I would like to do this without needing to contact the server if possible. I have looked at custom plugins such as "email composer" but the documentation seems to be limited and opon trying to use this, it doesnt work. This may be because I am using Cordova version 3.2.0 and icenium has changed the way their plugins work. Im not sure
Thank you
Have gotten email working for many apps using this plugin - Email Composer
Basically just install the plugin from this location and then use the appropriate code to call up the email composer within your app window.plugins.emailComposer.showEmailComposerWithCallback(callback,subject,body,toRecipients,ccRecipients,bccRecipients,isHtml,attachments,attachmentsData); an added feature is this plugin also offers the ability for attachments if needed.

Categories