Skip to content

Commit 405c787

Browse files
author
François Kooman
committed
initial commit
0 parents  commit 405c787

File tree

7 files changed

+471
-0
lines changed

7 files changed

+471
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
/config.php

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Introduction
2+
Simple VOOT client written in PHP.
3+
4+
# Installation
5+
Install the dependencies using [Composer](http://getcomposer.org):
6+
7+
$ php /path/to/composer.phar install
8+
9+
# Configuration
10+
Copy `config.php.example` to `config.php` and modify it for your configuration.
11+

callback.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
require_once 'vendor/autoload.php';
4+
require_once 'config.php';
5+
6+
use fkooman\OAuth\Client\ClientConfig;
7+
use fkooman\OAuth\Client\SessionStorage;
8+
use fkooman\OAuth\Client\Callback;
9+
use fkooman\OAuth\Client\AuthorizeException;
10+
11+
use Guzzle\Http\Client;
12+
13+
$clientConfig = new ClientConfig($config['client']);
14+
15+
try {
16+
$tokenStorage = new SessionStorage();
17+
$httpClient = new Client();
18+
$cb = new Callback("php-voot-client", $clientConfig, $tokenStorage, $httpClient);
19+
$cb->handleCallback($_GET);
20+
21+
header("HTTP/1.1 302 Found");
22+
header(sprintf("Location: %s", $config['base_uri']));
23+
exit;
24+
} catch (AuthorizeException $e) {
25+
// this exception is thrown by Callback when the OAuth server returns a
26+
// specific error message for the client, e.g.: the user did not authorize
27+
// the request
28+
die(sprintf("ERROR: %s, DESCRIPTION: %s", $e->getMessage(), $e->getDescription()));
29+
} catch (Exception $e) {
30+
// other error, these should never occur in the normal flow
31+
die(sprintf("ERROR: %s", $e->getMessage()));
32+
}

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "fkooman/php-voot-client",
3+
"require": {
4+
"fkooman/guzzle-bearer-auth-plugin": "dev-master",
5+
"fkooman/php-oauth-client": "0.3.*"
6+
}
7+
}

0 commit comments

Comments
 (0)