{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/oauth2-client/issues/200","labels_url":"https://api.github.com/repos/thephpleague/oauth2-client/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/oauth2-client/issues/200/comments","events_url":"https://api.github.com/repos/thephpleague/oauth2-client/issues/200/events","html_url":"https://github.com/thephpleague/oauth2-client/issues/200","id":53865318,"number":200,"title":"Authorization Bearer Header","user":{"login":"zot24","id":678498,"avatar_url":"https://avatars.githubusercontent.com/u/678498?v=3","gravatar_id":"","url":"https://api.github.com/users/zot24","html_url":"https://github.com/zot24","followers_url":"https://api.github.com/users/zot24/followers","following_url":"https://api.github.com/users/zot24/following{/other_user}","gists_url":"https://api.github.com/users/zot24/gists{/gist_id}","starred_url":"https://api.github.com/users/zot24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zot24/subscriptions","organizations_url":"https://api.github.com/users/zot24/orgs","repos_url":"https://api.github.com/users/zot24/repos","events_url":"https://api.github.com/users/zot24/events{/privacy}","received_events_url":"https://api.github.com/users/zot24/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-09T12:58:52Z","updated_at":"2015-01-09T18:04:00Z","closed_at":null,"body":"Hi there!\r\n\r\nI'm trying to integrate [Freeagent](https://dev.freeagent.com/docs) as a provider to your OAuth2 library however they send the token on each request in the headers, so my idea was override your method [fetchProviderData](https://github.com/thephpleague/oauth2-client/blob/374c3d41db38d1d2d4071c58fa5515f58ea4566e/src/Provider/AbstractProvider.php#L317) to be able to receive the token in that method and add it to the `header` as below:\r\n\r\n```\r\nprotected function fetchProviderData($url, \\League\\OAuth2\\Client\\Token\\AccessToken $token)\r\n    {\r\n        try {\r\n            $client = $this->getHttpClient();\r\n            $client->setBaseUrl($url);\r\n\r\n            $client->setDefaultOption('headers', ['Authorization' => 'Bearer ' . $token]);\r\n\r\n            $request = $client->get()->send();\r\n```\r\n\r\nDo you think it will be a good idea send a PR to change your [fetchProviderData](https://github.com/thephpleague/oauth2-client/blob/374c3d41db38d1d2d4071c58fa5515f58ea4566e/src/Provider/AbstractProvider.php#L317) method? for something like this:\r\n\r\n```\r\nprotected function fetchProviderData($url, \\League\\OAuth2\\Client\\Token\\AccessToken $token = null)\r\n``` \r\n\r\nSo we will be able to pass if we need it in our implementation the token.\r\n\r\nLet me know your thoughts!\r\n\r\nCheers"},"comment":{"url":"https://api.github.com/repos/thephpleague/oauth2-client/issues/comments/69372855","html_url":"https://github.com/thephpleague/oauth2-client/issues/200#issuecomment-69372855","issue_url":"https://api.github.com/repos/thephpleague/oauth2-client/issues/200","id":69372855,"user":{"login":"zot24","id":678498,"avatar_url":"https://avatars.githubusercontent.com/u/678498?v=3","gravatar_id":"","url":"https://api.github.com/users/zot24","html_url":"https://github.com/zot24","followers_url":"https://api.github.com/users/zot24/followers","following_url":"https://api.github.com/users/zot24/following{/other_user}","gists_url":"https://api.github.com/users/zot24/gists{/gist_id}","starred_url":"https://api.github.com/users/zot24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zot24/subscriptions","organizations_url":"https://api.github.com/users/zot24/orgs","repos_url":"https://api.github.com/users/zot24/repos","events_url":"https://api.github.com/users/zot24/events{/privacy}","received_events_url":"https://api.github.com/users/zot24/received_events","type":"User","site_admin":false},"created_at":"2015-01-09T18:04:00Z","updated_at":"2015-01-09T18:04:00Z","body":"Just to keep this update I decided to revert the changes I made in the PR and use the following approach instead which I reckon is more cleaner and don't need to change the actual code of [oauth2-client](https://github.com/thephpleague/oauth2-client/)\r\n\r\n```\r\n$freeAgent = new FreeAgent(array(\r\n    'sandbox' => true,\r\n    'clientId'  =>  $config->freeagent->apiId,\r\n    'clientSecret'  =>  $config->freeagent->apiKey\r\n));\r\n$token = $freeAgent->getAccessToken();\r\n$freeAgent->headers = ['Authorization' => 'Bearer'.$token];\r\n\r\n$contact = $freeAgent->createContact([\r\n    'first_name' => 'test',\r\n    'last_name' => 'test'\r\n]);\r\n```\r\n\r\nSo we inject the needed details just after create the object and get the token."}}