Created
June 26, 2017 14:22
-
-
Save mcaskill/039ad1ecf9cf91fd272273f902443dc8 to your computer and use it in GitHub Desktop.
Elogram Quickstart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Larabros\Elogram\Client; | |
header('Content-Type: application/json;charset=utf-8'); | |
/** Register the Composer autoloader */ | |
require dirname(__DIR__) . '/vendor/autoload.php'; | |
$clientId = ''; | |
$clientSecret = ''; | |
$redirectUrl = ''; | |
$client = new Client($clientId, $clientSecret, null, $redirectUrl); | |
// Start the session | |
session_start(); | |
// If we don't have an authorization code then get one | |
if (!isset($_GET['code'])) { | |
header('Location: ' . $client->getLoginUrl()); | |
exit; | |
} else { | |
$token = $client->getAccessToken($_GET['code']); | |
echo json_encode($token); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment