From f03e4a9e37d3164e1852df30f55c75727c284818 Mon Sep 17 00:00:00 2001
From: Woody Gilk <woody@ushahidi.com>
Date: Tue, 26 Aug 2014 11:42:41 -0500
Subject: [PATCH] Add a new "missing_token" exception message to Resource
 server

---
 src/League/OAuth2/Server/Resource.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/League/OAuth2/Server/Resource.php b/src/League/OAuth2/Server/Resource.php
index 898a3801..50bb7082 100644
--- a/src/League/OAuth2/Server/Resource.php
+++ b/src/League/OAuth2/Server/Resource.php
@@ -84,6 +84,7 @@ class Resource
         0   =>  'invalid_request',
         1   =>  'invalid_token',
         2   =>  'insufficient_scope',
+        3   =>  'missing_token',
     );
 
     /**
@@ -94,6 +95,7 @@ class Resource
         'invalid_request'    =>  'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "%s" parameter.',
         'invalid_token'      =>  'The access token provided is expired, revoked, malformed, or invalid for other reasons.',
         'insufficient_scope' =>  'The request requires higher privileges than provided by the access token. Required scopes are: %s.',
+        'missing_token'      =>  'The request is missing an access token in either the Authorization header or the %s request parameter.',
     );
 
     /**
@@ -109,6 +111,7 @@ class Resource
         'invalid_request'    =>  400,
         'invalid_token'      =>  401,
         'insufficient_scope' =>  403,
+        'missing_token'      =>  400,
     );
 
     /**
@@ -387,7 +390,7 @@ class Resource
         }
 
         if (empty($accessToken)) {
-            throw new Exception\MissingAccessTokenException(self::$exceptionMessages['invalid_request'], 0);
+            throw new Exception\MissingAccessTokenException(sprintf(self::$exceptionMessages['missing_token'], $this->tokenKey), 3);
         }
 
         return $accessToken;