shaufi10 / oauth2-php

Automatically exported from code.google.com/p/oauth2-php
MIT License
0 stars 0 forks source link

getAccessTokenParam can get oauth_token from header #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Get access token from oauth server
2. curl --header 'Authorization: OAuth oauth_token="my_token"' 
"my.api-server.com"
3. it will return error "Auth header found that doesn\'t start with "OAuth""

version: oauth2-php-23.tar.gz

Please provide any additional information below.

maybe because of at file OAuth2.php

line 951, change 

``if (strcmp(substr($auth_header, 0, 5), "OAuth ") !== 0)''

to 

``if (strcmp(substr($auth_header, 0, 6), "OAuth ") !== 0)''

and line 955, change

``if (preg_match('/\s*OAuth\s*="(.+)"/', substr($auth_header, 5), $matches) == 
0 || count($matches) < 2)''

to 
``if (preg_match('/\s*oauth_token\s*="([^"]+)"/', $auth_header, $matches) == 0 
|| count($matches) < 2)''

Original issue reported on code.google.com by sockpupp...@gmail.com on 7 Dec 2011 at 10:03