Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Facebook Connect integration in website


Go to End


5 Posts   2237 Views

Avatar
nzstephenf

Community Member, 63 Posts

28 June 2012 at 9:13pm

Hey there,
Just wondering how I can leave my Facebook app connected to a user as soon as they launch the app and not click on LOGIN now and then.

Avatar
nzstephenf

Community Member, 63 Posts

28 June 2012 at 9:36pm

TO EXPLAIN MORE:
I want users to be able to access the app and be automatically logged into the app and stay logged in

Avatar
tonibecker

Community Member, 6 Posts

28 June 2012 at 11:22pm

Hy buddy.
At first you can't access your app without being logged in. In fact you need a so called access token for your app.
To get more informations how to generate the token look here:
https://developers.facebook.com/docs/opengraph/using-app-tokens/

And here is a code example from my events_facebook import to get events from specific page and display it in silverstripe

<?php
require_once 'fb_api/facebook.php';

// Authenticate
$facebook = new Facebook(array(
'appId' => 'your_app_id',
'secret' => 'your_app_secret',
'cookie' => true, // enable optional cookie support
));

// Attempt to fetch SpiritGallery's events page
// place access token for your fanpage after events?access_token=
// also place your fanpage that you would like to pull events from in $events=$facebook->api('/fanpage_here/
try{
$events=$facebook->api('/radionationband/events?access_token=copy_your_token_here');
}catch (FacebookApiException $e){
error_log($e);
}

// Iterate through each event
foreach ($events["data"] as $event){

I hope this helps for the first time.

Avatar
Fionna

Community Member, 1 Post

29 June 2012 at 6:41am

Edited: 29/06/2012 6:41am

Hey, wonder if you tried apps like LoginRadius ? I am using it and it's easier than going through all these complicated APIs.

Avatar
nzstephenf

Community Member, 63 Posts

29 June 2012 at 9:28am

Does this code make/or cover the entire website having the user logged in?
Thank you for your response it's much appreciated =)