Skip to content

Instantly share code, notes, and snippets.

  • Save hugowetterberg/69536 to your computer and use it in GitHub Desktop.
Save hugowetterberg/69536 to your computer and use it in GitHub Desktop.
From b969757d5d6fb52f66560eea10a7299f1d81729b Mon Sep 17 00:00:00 2001
From: Hugo Wetterberg <hugo.wetterberg@goodold.se>
Date: Tue, 24 Feb 2009 12:58:51 +0100
Subject: [PATCH] Modified OAuth.php so that we can support consumer request according to the draft "Using OAuth for Consumer Requests" http://oauth.googlecode.com/svn/spec/ext/consumer_request/1.0/drafts/2/spec.html
---
lib/OAuth.php | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/OAuth.php b/lib/OAuth.php
index 576e139..51d1070 100644
--- a/lib/OAuth.php
+++ b/lib/OAuth.php
@@ -589,11 +589,16 @@ class OAuthServer {/*{{{*/
*/
private function get_token(&$request, $consumer, $token_type="access") {/*{{{*/
$token_field = @$request->get_parameter('oauth_token');
- $token = $this->data_store->lookup_token(
- $consumer, $token_type, $token_field
- );
- if (!$token) {
- throw new OAuthException("Invalid $token_type token: $token_field");
+ if (!empty($token_field)) {
+ $token = $this->data_store->lookup_token(
+ $consumer, $token_type, $token_field
+ );
+ if (!$token) {
+ throw new OAuthException("Invalid $token_type token: $token_field");
+ }
+ }
+ else {
+ $token = new OAuthToken('', '');
}
return $token;
}/*}}}*/
--
1.6.1+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment