Search code examples
facebookfbmlfbjs

How can i get an extended permission form an existing user in facebook application


i am developing a facebook application.now i need to get more permission form user like user_birthday. is it possible to get these permissions from an existing user who has already added this application. or is it possible to ask them these permissions again? anyone please help me...


Solution

  • IF you are using the graph api then you can follow these steps after creating the object of facebook

    //Facebook Authentication part
        $session = $facebook->getSession();
        $loginUrl = $facebook->getLoginUrl(
                array(
                'canvas'    => 1,
                'fbconnect' => 0,
                'req_perms' => 'email,publish_stream,status_update,user_birthday, user_location,user_work_history'
                )
        );
    
        $fbme = null;
    
        if (!$session) {
            echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
            exit;
        }
        else {
            try {
                $uid      =   $facebook->getUser();
                $fbme     =   $facebook->api('/me');
    
            } catch (FacebookApiException $e) {
                echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
                exit;
            }
        }
    

    Add new permission in 'req_perms' parameter It will automatically redirect user to get new permissions You can check the related tutorial here http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/