PHP code example of jakubpas / oauth

1. Go to this page and download the library: Download jakubpas/oauth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jakubpas / oauth example snippets



use JakubPas\Oauth;

$oauth = new JakubPas\Oauth\Connector(
    'Facebook',
    'facebook application id ', 
    'facebook application secret', 
    'http://www.example.com/redirect/after/authorization',
    'email'
);
if (!isset($_POST[$oauth->getResponseType()])) {
    $oauth->authorize();
} else {
    $userProfile = $oauth->getUserProfile($_POST[$oauth->getResponseType()]);
    $data = json_decode($userProfile);
    // Login here....
}