Create Facebook wall post from embedded application - c++

I'm working on a project where I want to post a wall message to the users Facebook page but the problem is that the program will run on a very limited system and the only way I have to talk with Facebook is via sockets in C/C++.
Anyone have any code examples of how to do this?
Asking for the username/password is no problem so I will have this but I would also like to be able to do all this without them having to add a application to there Facebook page.
All documentation on Facebook.com is for when you can show a web browser but there must be some way you can do this, right?
/Viktor

sockets <-> Facebook?
the right way to do that is using facebook's REST api or CONNECT. You could try to use oauth2 to authenticate and then make http calls. You can try to use curl. I don't think you can use sockets unless you are inside facebook's layer.

Related

Will Facebook's manual login flow allow a mobile webview to automatically launch Facebook's native app?

I've successfully implemented Facebook login with their Javascript SDK but was hoping that when used on mobile, the native Facebook application would launch. Will going through the manual flow here allow this behavior? This question seems to say otherwise but was vague.
I want to avoid using Android and iOS mobile SDKs because my situation is basically an OAuth within an OAuth and it would get messy. Any other approaches people think could work like redirect URIs or other OAuth magic would be really appreciated.

How to Connect Rails Client to IndentityServer SSO provider

At work we have a system set up running a ThinkTecture IndentityServer SSO provider which currently provides authentication for several .NET and ColdFusion sites. I am currently working on a new site we are supporting in Ruby on Rails and am having difficulty figuring out how to connect it to the SSO. (I'm pretty new to rails, but a long time developer in CF and .NET)
I've looked at the omniauth-oauth2 and oauth2 gems but it seems there are important parts missing from the documentation and explanations I can find. There is a ton of info if I wanted to authenticate using Twitter, Facebook or something similar, but I can't find anything that just addresses the client side for any generic OAuth2 provider.
I'm just looking for someone to point me in the right direction to find information on how I can do this. I don't care if it's specific to IdentityServer or just generic regardless of the provider. Thanks for the help.
Update: Just so you know, I would prefer to use OAuth2 for this connection, but I am not opposed to using any of the other ways that IdentityServer provides, including ADFS, WSFed or Simple HTTP. I can't use OpenID, though, because these accounts are specific to our system and can't be used for other systems.
You really need an open id connect library.
http://openid.net/developers/libraries/
It turns out this is pretty easy, overall. The difficulty is that there is no straight answer to the question. How you connect to IdentityServer entirely depends upon how IdentityServer is set up.
I'm not going to post my exact code, as this will not help anyone who doesn't have IdentityServer set up exactly the same way we do, and as I don't have access to the IdentityServer, I can't say exactly how that is. I will explain the overall solution, though.
The only gem needed for this is JWT
Get key codes from IdentityServer admin (client id, secret key, sign key)
Build login URL according to configuration of IdentityServer
Redirect user to login path generated in the last step
Receive token back from IdentityServer
Decode and verify using the JWT.decode function
From there you just have a JSON string with your data.

How to deal with oAuth callbacks to non webservers?

I'm currently building an oAuth2 server so that external clients/devices can access data from my service without having to send over user credentials with every request. I've finally grasped how oAuth works after spending an entire day reading numerous tutorials and online documentation, however, there's still one thing that I'm rather unsure of...
When sending a request for an authorization code to an oAuth server, how should I deal with a callback to mobile devices and devices that aren't a webserver?
E.g. this request to my oAuth server will send an authorization code as a callback to a specified webserver (http://client-url.com in this case)
http://mydomainname/oauth2/?client_id=test&grant_type=authorization_code&client_details=test&redirect_uri=http://client-url.com&response_type=code
The server at http://client-url.com will receive a response containing an authorization code and the developer will be able to store a user's oAuth credentials accordingly.
Obviously a mobile device isn't a webserver, so is there a standardised way of dealing with this? I've read online that you can define something called a custom URI scheme within iOS and Android apps. But what about the other mobile platforms out there? And desktop apps? I want my API to be accessible from as many platforms and devices as possible.
The reason why I'm asking this question is because I want to add validation to my oAuth server so that users can only register apps with valid callback URL's. I wasn't sure if should allow any other type of input as a callback apart from a valid URL.
Can anyone shine any light on this? I want to avoid spending hours validating and testing this across all devices as I'm sure anyone that has developed for multiple mobile platforms in the past must have some knowledge about this.
Thanks in advance.

Facebook app requesting Youtube watch history

We are working on an idea of a FB app which let's us retrieve youtube watch histories of app users.
I know there's the possibility to retrieve watch histories through youtube's api, but in combination with a FB app I couldn't find examples.
Any input on this is much appreciated, thanks!
These two are orthogonal. Since you didn't specify a language, I'll assume you're using Python.
Write an FB app using Canvas to display output to users ... I assume you are using Canvas.
Use the YouTube API and Python client to make API calls. You'll need to use a database or some other storage engine to link a user's Facebook API auth token with their Google auth token. Both are using OAuth 2.0 (though they are different flavors), so once you learn one, the other should be easy.
Before I answer anymore questions, it's probably a good idea for you to work through the getting started guides for both Facebook's API and YouTube API first. After you have some understanding of both, pick a stack and you should more or less be ready to go.

Sample of using Facebook Connect with MonoTouch

I'm using MonoTouch (latest version) and I want to be able to allow the user of my app to make a wall post based on a log entry made in this app. All I need is a simple implementation so that the user can tap "Share on Facebook" (UIActionSheet) and then it logs them into Facebook (shows the login) and returns the token which I can then use to make the WebRequest to post to their wall.
I've seen the MonoTouch bindings on github but have no idea how to use it. Can someone please provide a simple sample of how to just login to Facebook to retrieve a token so I can post. I know how to do the post, it's the auth process that I'm not getting right.
Thank you.
Neal
Neal,
I have added a sample that replicates about half of the Facebook sample here:
https://github.com/mono/monotouch-bindings/tree/master/facebook/sample
I would recommend to use client-side javascript login more than native device login.
Sooner or later you might want an Android, Windows Phone or even Facebook version.
Having an In-App browser wrapper to deal with javascript and direct Graph API calls are easier for cross-platform implementation. Just from my personal experience.