summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-02 20:02:31 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-02 20:02:31 -0400
commite3d88270cc0fcdfc667f0a120040864818b3b2a1 (patch)
treefe08e9cec469262ca559df95d656650aa7a6409a /settings
parent4b9200f6f7a571c251ef89599e1af9e25e2e75f4 (diff)
downloadnextcloud-server-e3d88270cc0fcdfc667f0a120040864818b3b2a1.tar.gz
nextcloud-server-e3d88270cc0fcdfc667f0a120040864818b3b2a1.zip
OAuth server implementation using oauth library
Diffstat (limited to 'settings')
-rw-r--r--settings/oauth.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/settings/oauth.php b/settings/oauth.php
index 2592b926d17..9e7a3c04935 100644
--- a/settings/oauth.php
+++ b/settings/oauth.php
@@ -9,6 +9,7 @@ require_once('../lib/base.php');
// Logic
$operation = isset($_GET['operation']) ? $_GET['operation'] : '';
+$server = new OC_OAuthServer(new OC_OAuthStore());
switch($operation){
case 'register':
@@ -16,8 +17,15 @@ switch($operation){
break;
case 'request_token':
- break;
-
+ try {
+ $request = OAuthRequest::from_request();
+ $token = $server->fetch_request_token($request);
+ echo $token;
+ } catch (OAuthException $exception) {
+ OC_Log::write('OC_OAuthServer', $exception->getMessage(), OC_LOG::ERROR);
+ echo $exception->getMessage();
+ }
+ break;
case 'authorise';
OC_Util::checkLoggedIn();
// Example
@@ -56,8 +64,15 @@ switch($operation){
break;
case 'access_token';
- break;
-
+ try {
+ $request = OAuthRequest::from_request();
+ $token = $server->fetch_access_token($request);
+ echo $token;
+ } catch (OAuthException $exception) {
+ OC_Log::write('OC_OAuthServer', $exception->getMessage(), OC_LOG::ERROR);
+ echo $exception->getMessage();
+ }
+ break;
default:
// Something went wrong
header('Location: /');