Skip to content
Snippets Groups Projects
Commit 5933d439 authored by Tom Needham's avatar Tom Needham
Browse files

Basic template for authorising exernal apps with OAuth

parent 038af7e6
Branches
No related tags found
No related merge requests found
<?php
/**
* Copyright (c) 2012, Tom Needham <tom@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
require_once('../lib/base.php');
// Logic
$operation = isset($_GET['operation']) ? $_GET['operation'] : '';
switch($operation){
case 'register':
break;
case 'request_token':
break;
case 'authorise';
// Example
$consumer = array(
'name' => 'Firefox Bookmark Sync',
'scopes' => array('bookmarks'),
);
$t = new OC_Template('settings', 'oauth', 'guest');
$t->assign('consumer', $consumer);
$t->printPage();
break;
case 'access_token';
break;
default:
// Something went wrong
header('Location: /');
break;
}
<?php
/**
* Copyright (c) 2012, Tom Needham <tom@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
?>
<p><strong><?php echo $_['consumer']['name']; ?></strong> is requesting permission to read, write, modify and delete data from the following apps:</p>
<ul>
<?php
// Foreach requested scope
foreach($_['consumer']['scopes'] as $app){
echo '<li>'.$app.'</li>';
}
?>
</ul>
<button>Disallow</button>
<button>Allow</button>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment