Page 1 of 1

Facebook connection?

Posted: Fri Feb 10, 2012 4:34 pm
by Brujah
Hy everybody,

I just started to read about the facebook api.
Did anybody already get a purebasic program to post on facebook?

I would like to post new highscores of our users to facebook if they like that.
So I need the program to read in username/password and after that do that oauth stuff.

Just would like to know if somebody already did this successfully and maybe give me some hints.

Cheers,
Markus

Re: Facebook connection?

Posted: Fri Feb 10, 2012 4:37 pm
by Shield
It's pretty straight forward actually. There is a whole documentation
about all the API stuff on Facebook itself, just check it out. :)

I tried it a couple of years ago and it was rather easy,
but I don't think I ever saw any examples around here.

Re: Facebook connection?

Posted: Fri Feb 10, 2012 5:09 pm
by Brujah
As I see it I have to do something like that:

Code: Select all

Desktop Apps

Our OAuth 2.0 implementation does not include explicit desktop app support. However, if your desktop app can embed a web browser (most desktop frameworks such as .NET, AIR and Cocoa support embedding browsers), you can use the client-side flow with one modification: a specific redirect_uri. Rather than requiring desktop apps to host a web server and populate the Site URL in the Developer App, we provide a specific URL you can use with desktop apps: https://www.facebook.com/connect/login_success.html.

    Embed a web browser and load the OAuth Dialog (https://www.facebook.com/dialog/oauth) using the client-side flow (i.e. response_type=token):

https://www.facebook.com/dialog/oauth?
    client_id=YOUR_APP_ID&
    redirect_uri=https://www.facebook.com/connect/login_success.html

    After the user authorizes your app, we redirect the user back to the redirect_uri with the access token in the URI fragment:

https://www.facebook.com/connect/login_success.html#access_token=...

    Detect this redirect and then read the access token out of the URI using whatever mechanisms provided by your framework of choice.
No clue yet how I embed a browser in purebasic.

Re: Facebook connection?

Posted: Sat Feb 11, 2012 7:00 am
by Bisonte
Brujah wrote:No clue yet how I embed a browser in purebasic.
WebGadget() ?

Re: Facebook connection?

Posted: Wed Feb 15, 2012 5:17 pm
by Brujah
Yes. this should do the job.

I have a problem that my kubuntu shows only an empty window when I start the testprogram.
Probably a gtk lib is missing here.
No clue though which one this could be :(