Skip to content

Commit

Permalink
When you make requests to the Eventbrite API using oauth2 access_toke…
Browse files Browse the repository at this point in the history
…n you need to send an Authorization header field with value of Bearer otherwise you get error.

This is not needed for all the oauth stuff just the last call to the API to fetchUserDetails.

I am not sure if this will brake other requests to other providers or if they will just ignore this extra header?
  • Loading branch information
jamesmills committed Feb 4, 2014
1 parent b5aa8a6 commit 754250d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/League/OAuth2/Client/Provider/IdentityProvider.php
Expand Up @@ -171,6 +171,7 @@ protected function fetchUserDetails(AccessToken $token, $force = false)
try {

$client = new GuzzleClient($url);
$client->setDefaultOption('headers', array('Authorization' => 'Bearer'));
$request = $client->get()->send();
$response = $request->getBody();
$this->cachedUserDetailsResponse = $response;
Expand Down

6 comments on commit 754250d

@suwardany
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jamesmills this has actually broken the Google provider, doesn't play nice with the header!

@jamesmills
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess we need to do some sort of Provider check to see if we need to add the header or not. Will look now.

@jamesmills
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope this fixes it. #61

@robertpitt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also breaks Oauth-Server is it expectes a token.

@jamesmills
Copy link
Contributor Author

@jamesmills jamesmills commented on 754250d Feb 10, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertpitt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using the Oauth-Server package with close to the default configurations, when using the Oauth-Client to access a resources using the Oauth-Server@Resource.php, the exception regarding missing token is throw due to this header being sent without a token.

See this:

https://github.com/thephpleague/oauth2-server/blob/develop/src/League/OAuth2/Server/Resource.php#L262

Please sign in to comment.