Teamspeak 3 - Facebook Connection

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
ITs not difficult. u need app facebook ,if u have project PM me i work on facebook api + php and ts3
i got facebook api, but i have never used it before, or at least try to make my own stuff with it ;)
I don't have any project generally, i just have a page that when you click the connect button the user connect to a ts server. nothing else.
 

EscuderoKevin

Well-Known Member
Jul 2, 2015
380
181
130
i got facebook api, but i have never used it before, or at least try to make my own stuff with it ;)
I don't have any project generally, i just have a page that when you click the connect button the user connect to a ts server. nothing else.

If u say "BUTTON" in Facebook Pages , thats not working only Open php u can autorize app , Take name With Token and then Connect to TS3.

Code:
<?php
    
    if (session_status() == PHP_SESSION_NONE) {
        session_start();
    }
    require_once( 'autoload.php' );
    
    use Facebook\FacebookSession;
    use Facebook\FacebookRedirectLoginHelper;
    use Facebook\FacebookRequest;
    use Facebook\FacebookResponse;
    use Facebook\FacebookSDKException;
    use Facebook\FacebookRequestException;
    use Facebook\FacebookAuthorizationException;
    use Facebook\GraphObject;
    use Facebook\Entities\AccessToken;
    use Facebook\HttpClients\FacebookCurlHttpClient;
    use Facebook\HttpClients\FacebookHttpable;
    // init app with app id and secret
    FacebookSession::setDefaultApplication( 'APP ID','APP SECRET' );
    // login helper with redirect_uri
    $helper = new FacebookRedirectLoginHelper('Link to this file.' );
    try {
        $session = $helper->getSessionFromRedirect();
        } catch( FacebookRequestException $ex ) {
        // When Facebook returns an error
        } catch( Exception $ex ) {
        // When validation fails or other local issues
    }
    // see if we have a session
    if ( isset( $session ) ) {
        // graph api request for user data
        $request = new FacebookRequest( $session, 'GET', '/me' );
        $response = $request->execute();
        // get response
        $graphObject = $response->getGraphObject();
        $fbid = $graphObject->getProperty('id');              // To Get Facebook ID
        $fbfullname = $graphObject->getProperty('name');
        $femail = $graphObject->getProperty('email');   
        header("Location: index.php".$extra);
        } else {
        $loginUrl = $helper->getLoginUrl(array('req_perms' => 'email'));
        header("Location: ".$loginUrl);       
    }
?>

That Code with correct info and config APP. Its for Make Token , Validate and TAKE in $fbid , $fbfullname , $femail. thats values.
 
Top