Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Facebook App permissions? (PHP)

Options
  • 15-01-2013 8:27pm
    #1
    Registered Users Posts: 4,946 ✭✭✭


    Hey

    I've never really looked into building an app for facebook, but I'm just starting to get around to it now. I dont have an SSL on my private server where I am hosting the files, so right away I kind of have a problem... but I can still load the page so its ok. I kind of feel silly asking about this, as building an app is something that I really should have done a long time ago. As usual with me, I've come across something really simple, and I'm stumped, but once I get over it I should be fine.

    I got my hands on the PHP files that facebook supply you with, I uploaded them to my file server, and loaded up the app. It worked fine, displaying simple information.

    I can echo out
    [PHP]<?php echo $user_profile; ?>[/PHP]
    and so on which displays my first name. Grand...

    The app I'm trying to build needs to store the users email address. So, I've changed

    [PHP]$loginUrl = $facebook->getLoginUrl();[/PHP]
    to
    [PHP]$params = array(
    'scope'=>'email',
    'redirect_uri' => 'https://www.whatever.com/mehhhhhhh'
    );
    $loginUrl = $facebook->getLoginUrl($params);[/PHP]

    Yet I cannot seem to see the users email address with,

    [PHP]<?php echo $user_profile; ?>[/PHP]

    Not only that, I am not getting a popup box requesting access to that information. Infact, once I've logged in, I dont get anything but the user data!

    Can someone direct me to a good tutorial, or even put some sample PHP code that will show the 'request access' popup and get access to a users email using the $params var I created? I've come across the JavaScript sdk, and loaded it up, when you login it requests permission to access basic information, which is cool, but I'm not really that handy with javascript unless its for animations and sorts.

    I understand it comes across as me asking someone to build my app, but I cannot find ANYTHING that is up to date in terms of facebook apps. As everything I come across is getSession();, not getUser(); etc. If I can see a hands on example of a popup, access to a scope, and echoing out the email variable I should be able to progress from there on with whatever I need to do.

    Cheers


Comments

  • Moderators, Society & Culture Moderators Posts: 17,642 Mod ✭✭✭✭Graham


    IIRC you need to request extended permissions to be able to access the email address. It's the request for extended permissions which kicks off the popup box.

    Its something along the lines of:

    'req_perms' => 'email' in your $params array


  • Registered Users Posts: 4,946 ✭✭✭red_ice


    Graham wrote: »
    IIRC you need to request extended permissions to be able to access the email address. It's the request for extended permissions which kicks off the popup box.

    Its something along the lines of:

    'req_perms' => 'email' in your $params array

    req_perms has been replaced with 'scope' now, might be because Facebook uses 'OAuth 2.0'. I'm not sure.

    I was literally about to put my fist through the screen, then I middle clicked on login and up came the window I was looking for, requesting what I wanted it to request, and displaying all the information I need. So happy days, its all sorted! Thanks for your input, it did lead to me looking down another avenue which I didn't look at previously.

    I think I have everything I need now,

    Cheers


Advertisement