aboutsummaryrefslogtreecommitdiff
path: root/vendor/oauth-php/example/server/www/register.php
blob: 0a74297b204530ac055d3c97da7107d0f5b01382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

require_once '../core/init.php';

assert_logged_in();

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
	try
	{
		$store = OAuthStore::instance();
		$user_id = 1; // this should not be hardcoded, of course
		$key   = $store->updateConsumer($_POST, $user_id, true);

		$c = $store->getConsumer($key, $user_id);
		echo 'Your consumer key is: <strong>' . $c['consumer_key'] . '</strong><br />';
		echo 'Your consumer secret is: <strong>' . $c['consumer_secret'] . '</strong><br />';
	}
	catch (OAuthException2 $e)
	{
		echo '<strong>Error: ' . $e->getMessage() . '</strong><br />';
	}
}
		

$smarty = session_smarty();
$smarty->display('register.tpl');

?>