Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d9727a

Browse files
author
Dave Rochwerger
committed
Fix for broken Android Request header (version 2.2) implementation - we now ignore case for 'Authorization' header.
1 parent 07d0b89 commit 9d9727a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/OAuth2.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ public function verifyAccessToken($token_param, $scope = NULL) {
466466
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.2
467467
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.3
468468
*
469+
* Old Android version bug (at least with version 2.2)
470+
* @see http://code.google.com/p/android/issues/detail?id=6684
471+
*
469472
* We don't want to test this functionality as it relies on superglobals and headers:
470473
* @codeCoverageIgnoreStart
471474
*/
@@ -475,7 +478,10 @@ public function getBearerToken() {
475478
}
476479
elseif (function_exists('apache_request_headers')) {
477480
$requestHeaders = apache_request_headers();
478-
481+
482+
// Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
483+
$requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders));
484+
479485
if (isset($requestHeaders['Authorization'])) {
480486
$headers = trim($requestHeaders['Authorization']);
481487
}

0 commit comments

Comments
 (0)