Can I use the facebook feed dialog to post raw image data? - javascript

I am generating a png using the html5 canvas element, so I have raw data in the form of a data:image url... Is it possible to use this data to post a picture to a facebook wall?
I'm assuming the answer is 'no', as I receive the following error:
API Error Description: The specified URL is not owned by the
application
It does upload the image, apparently, as I'm on a slow coffee-shop connection and can watch the upload percent slowly complete.
I'm using the feed dialog because I'd prefer not to have a separate app that required auth...

When you create a application on facebook developer portal you will be asked to give a url of your app, this means when you take data, such as pictures, json or whatnot, this domain name is allowed, if you enter www.me.com as your app domain and then create a url/picture for a feed submission you have to use the same url and not www.someoneelse.org because the sdk uses the app profile as reference. security checks and whatnot.

Related

How to upload image from a URL to server using Angular-upload?

Here is the scenario, in my application, user logs in through their Facebook account, after Facebook authorization, I receive user's profile information, including a url to their profile picture, and on the next page I fill some parts of my form using the info I've received from Facebook Graph API.
My question is how can I upload user's profile picture as the main picture of their account in my application as I'm getting only a URL to that picture from Facebook API ?
Please note that I'm using AngularJS and a plugin to handle uploads, called Angular Upload.
I'm totally open to any suggestions or other workarounds.
Thanks in advance.

Building a desktop facebook application

I am trying to build a Desktop Facebook application which will display the list of friends of a logged-in user. I am trying to do this using the Facebook javascript SDK. However when I open the HTML page, i get the following error:
Given URL is not allowed by the Application configuration.: One or
more of the given URLs is not allowed by the Application
configuration. It must match one of the Connect or Canvas URLs or
domain must be the same as or a subdomain of one of the Application
I do understand that Facebook is asking for a URL from where this application will be called. However I would like to just run it by opening a HTML file from my local drive, rather than through a website. Is this possible to do?
There is a post on facebook (https://developers.facebook.com/bugs/165982843535513/) which indicates that this might not be possible. However the post was made about 3 years ago. Is there a possible work around for this currently?
You have to build a manual login flow:
To use Facebook Login in a desktop app, you'll need to be able to
embed a web browser (sometimes called a webview) within the app to
perform the login process.
Source: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.3
Just in case you donĀ“t know, you can only get friends who authorized your App too.

Soundcloud: Is there a way to upload a file via HTML and JS?

Does anyone know if there's a way to upload a file that a user selects (typical HTML-based file input tag) without the current limitation in the SoundCloud API (which seems to be limited to recording local audio)?
I implemented something similar with Vimeo's API which goes something like this:
Get access token to avoid having to use OAuth or require a user to be a Soundcloud user to upload to my account.
Post a request to the API to get an upload token and URL.
Do an HTTP PUT against the upload URL with the file the user selected using HTML5's File API - Note this requires the user to accept the request via headers.
Check upload status (in Vimeo's case, you just re-PUT without data but with the ticket Id which is in the upload URL).
When done, make another API call to finish the process and trigger transcoding.
I'm essentially trying to enable user uploads of audio files and just send the file itself directly to Soundcloud an my account there rather than uploading to my servers and essentially doubling the work by uploading from my server to Soundcloud's.
I see that the SoundCloud JS Api supports PUTs for other tasks. I don't mind manually doing the XHR/Ajax calls directly (I'm using jQuery.ajax) but since the JS SDK hides the process a bit, I don't know how for sure how to approach it, if I can at all.
Anyone try this or happen to know how to make it happen?
This is not possible (for everyone).
In the section "Authenticating without the SoundCloud Connect Screen" on the following soundcloud API docs page:
https://developers.soundcloud.com/docs/api/guide#authentication
It says:
Our Terms of Service specify that you must use the Connect with
SoundCloud screen unless you have made a separate arrangement with us.
So unless you have a deal with soundcloud,
there's no way you can 'automatically' let a program upload sounds (or doing any modification to soundcloud whatsoever) without having to authenticate first.

How to link from a webpage to Facebook STATUS in iOS native Facebook app via fb://

I've seen a fair amount of stuff about retrieving a Facebook user profile or page via fb:// from within a webpage to direct iOS to open the profile or page in the native Facebook app rather than in the browser on iOS devices. However, I see nothing about how to do so for Facebook status updates.
The behavior I am looking for is to provide a link to a Facebook status on a webpage (HTML5) and when the user clicks on it, to have the user be switched over to Facebook's native app and have the status show up in the app. My question is specific to status updates (sometimes called posts), and not pages or user profiles.
If it helps at all, the link is presented in a Sencha application packaged in PhoneGap/Cordova.
Any help would be much appreciated. I haven't seen anything directly on point around the web.
Isn't a status is just a type of post?
if so, you can find the postid of it and then use "fb://post/(postId)"
The solution is that you need to add userid and an "_" before the actual post id for it to work. most of the data you get back via graph or whatever sdk has the post id as just the single id without the users id and an underscore in front of it.
so it would look like:
fb://post/453453454_34857894375345
first set of numbers being the userid(not an actual one) and the second being the post id(also just random numbers i typed).
haven't tested going from web to native, but just tested it in a native app we made that successfully opens the facebook app to that specific post.

How does Asana handle URLs without a #

You may have seen app.asana.com.
If not you should check it out, it is a very nice designed webapp.
But I can't figure out how they handle the whole URL management.
Backbone.js or Knockout.js handles the URL with the #, and everything after that is just generated.
But asana doesn't have a hash and can modify the URL, how are they doing this?
Looks like they're using HTML5 history.pushState(); so they don't have to refresh the page and so they don't have to use # (hashes) in the URL to go to a certain part in a web app.
Here's a good tutorial about history.pushState();: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history
This is the what Google+ and Facebook uses to change the URL without refreshing.
I hope this helps.
HTML5 Push State: http://spoiledmilk.dk/blog/html5-changing-the-browser-url-without-refreshing-page
The big benefit here is that if you paste an Asana URL directly into the browser (or click on a link from an email), the server sees the full URL and can immediately send the appropriate task data to the client. We used to use url fragments, but we needed to do a second round trip after the application loaded to read the fragment in JavaScript and pass it to the server.

Categories