Skip to content

Instantly share code, notes, and snippets.

@mcaskill
Created June 26, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcaskill/039ad1ecf9cf91fd272273f902443dc8 to your computer and use it in GitHub Desktop.
Save mcaskill/039ad1ecf9cf91fd272273f902443dc8 to your computer and use it in GitHub Desktop.
Elogram Quickstart
<?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