Facebook connection?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

Facebook connection?

Post 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
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Facebook connection?

Post 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.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

Re: Facebook connection?

Post 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.
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Facebook connection?

Post by Bisonte »

Brujah wrote:No clue yet how I embed a browser in purebasic.
WebGadget() ?
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

Re: Facebook connection?

Post 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 :(
Post Reply