{"action":"opened","number":206,"pull_request":{"url":"https://api.github.com/repos/requests/requests-oauthlib/pulls/206","id":51299682,"html_url":"https://github.com/requests/requests-oauthlib/pull/206","diff_url":"https://github.com/requests/requests-oauthlib/pull/206.diff","patch_url":"https://github.com/requests/requests-oauthlib/pull/206.patch","issue_url":"https://api.github.com/repos/requests/requests-oauthlib/issues/206","number":206,"state":"open","locked":false,"title":"Added authorization header for token access","user":{"login":"ibuchanan","id":763608,"avatar_url":"https://avatars.githubusercontent.com/u/763608?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuchanan","html_url":"https://github.com/ibuchanan","followers_url":"https://api.github.com/users/ibuchanan/followers","following_url":"https://api.github.com/users/ibuchanan/following{/other_user}","gists_url":"https://api.github.com/users/ibuchanan/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuchanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuchanan/subscriptions","organizations_url":"https://api.github.com/users/ibuchanan/orgs","repos_url":"https://api.github.com/users/ibuchanan/repos","events_url":"https://api.github.com/users/ibuchanan/events{/privacy}","received_events_url":"https://api.github.com/users/ibuchanan/received_events","type":"User","site_admin":false},"body":"This change adds a Basic Auth header into `fetch_token`.\r\nWhy?\r\n\r\nThe relevant section of the OAuth 2.0 specification, [2.3.1. Client Password](https://tools.ietf.org/html/rfc6749#section-2.3.1) reads:\r\n\r\n> Clients in possession of a client password MAY use the\r\n> HTTP Basic authentication scheme...\r\n\r\nBut for servers, it reads:\r\n\r\n> The authorization server MUST support the\r\n> HTTP Basic authentication scheme for authenticating clients\r\n> that were issued a client password.\r\n\r\nClients MAY send Basic Auth,\r\nbut servers MUST accept it.\r\nBefore this commit, `fetch_token` DOES NOT use this scheme.\r\nInstead, it sends `client_id` and `client_secret` in the body.\r\nThe spec says this about that:\r\n\r\n> Including the client credentials in the request-body\r\n> using the two parameters is NOT RECOMMENDED\r\n> and SHOULD be limited to clients unable to directly utilize\r\n> the HTTP Basic authentication scheme...\r\n\r\nBut for servers, it reads:\r\n\r\n> The authorization server MAY support including\r\n> the client credentials in the request-body...\r\n\r\nClients are NOT RECOMMENDED to send a body,\r\nand servers MAY accept it.\r\nSo this client DOES something that is NOT RECOMMENDED.\r\nHowever, Fixing that would be a breaking change.\r\nFurthermore, this clearly works for non-compliant OAuth servers.\r\n\"Ain't broke so don't fix it.\"\r\n\r\nA compliant server may accept Basic Auth and not a request-body.\r\nWhich is the current case for Bitbucket.\r\nBefore this commit, the following is a simple work-around:\r\n\r\n```\r\n    # Fetch the access token\r\n    basic_auth = HTTPBasicAuth(client_id, client_secret)\r\n    bitbucket.fetch_token(\r\n      token_uri,\r\n      authorization_response=redirect_response,\r\n      auth=basic_auth)\r\n```\r\n\r\nWith a one line change (and 50+ lines of commit message),\r\n`fetch_token` is now more compliant and works with Bitbucket.","created_at":"2015-11-19T23:55:03Z","updated_at":"2015-11-19T23:55:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b25eafe48fc75636ba227121acb98c03eb6addf2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/requests/requests-oauthlib/pulls/206/commits","review_comments_url":"https://api.github.com/repos/requests/requests-oauthlib/pulls/206/comments","review_comment_url":"https://api.github.com/repos/requests/requests-oauthlib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/requests/requests-oauthlib/issues/206/comments","statuses_url":"https://api.github.com/repos/requests/requests-oauthlib/statuses/37f1e9b5b5583ff998ce295ab94b72e32beb236a","head":{"label":"ibuchanan:bug/basic-auth-for-fetch-token","ref":"bug/basic-auth-for-fetch-token","sha":"37f1e9b5b5583ff998ce295ab94b72e32beb236a","user":{"login":"ibuchanan","id":763608,"avatar_url":"https://avatars.githubusercontent.com/u/763608?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuchanan","html_url":"https://github.com/ibuchanan","followers_url":"https://api.github.com/users/ibuchanan/followers","following_url":"https://api.github.com/users/ibuchanan/following{/other_user}","gists_url":"https://api.github.com/users/ibuchanan/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuchanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuchanan/subscriptions","organizations_url":"https://api.github.com/users/ibuchanan/orgs","repos_url":"https://api.github.com/users/ibuchanan/repos","events_url":"https://api.github.com/users/ibuchanan/events{/privacy}","received_events_url":"https://api.github.com/users/ibuchanan/received_events","type":"User","site_admin":false},"repo":{"id":46524403,"name":"requests-oauthlib","full_name":"ibuchanan/requests-oauthlib","owner":{"login":"ibuchanan","id":763608,"avatar_url":"https://avatars.githubusercontent.com/u/763608?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuchanan","html_url":"https://github.com/ibuchanan","followers_url":"https://api.github.com/users/ibuchanan/followers","following_url":"https://api.github.com/users/ibuchanan/following{/other_user}","gists_url":"https://api.github.com/users/ibuchanan/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuchanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuchanan/subscriptions","organizations_url":"https://api.github.com/users/ibuchanan/orgs","repos_url":"https://api.github.com/users/ibuchanan/repos","events_url":"https://api.github.com/users/ibuchanan/events{/privacy}","received_events_url":"https://api.github.com/users/ibuchanan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ibuchanan/requests-oauthlib","description":"OAuthlib support for Python-Requests!","fork":true,"url":"https://api.github.com/repos/ibuchanan/requests-oauthlib","forks_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/forks","keys_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/teams","hooks_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/hooks","issue_events_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/issues/events{/number}","events_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/events","assignees_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/assignees{/user}","branches_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/branches{/branch}","tags_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/tags","blobs_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/statuses/{sha}","languages_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/languages","stargazers_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/stargazers","contributors_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/contributors","subscribers_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/subscribers","subscription_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/subscription","commits_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/contents/{+path}","compare_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/merges","archive_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/downloads","issues_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/issues{/number}","pulls_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/pulls{/number}","milestones_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/milestones{/number}","notifications_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/labels{/name}","releases_url":"https://api.github.com/repos/ibuchanan/requests-oauthlib/releases{/id}","created_at":"2015-11-19T22:30:31Z","updated_at":"2015-11-19T22:30:32Z","pushed_at":"2015-11-19T23:49:36Z","git_url":"git://github.com/ibuchanan/requests-oauthlib.git","ssh_url":"git@github.com:ibuchanan/requests-oauthlib.git","clone_url":"https://github.com/ibuchanan/requests-oauthlib.git","svn_url":"https://github.com/ibuchanan/requests-oauthlib","homepage":"https://requests-oauthlib.readthedocs.org/","size":234,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"requests:master","ref":"master","sha":"dd883a82ba8f470e3d8a9675be150ec27b9ebb1d","user":{"login":"requests","id":2805331,"avatar_url":"https://avatars.githubusercontent.com/u/2805331?v=3","gravatar_id":"","url":"https://api.github.com/users/requests","html_url":"https://github.com/requests","followers_url":"https://api.github.com/users/requests/followers","following_url":"https://api.github.com/users/requests/following{/other_user}","gists_url":"https://api.github.com/users/requests/gists{/gist_id}","starred_url":"https://api.github.com/users/requests/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/requests/subscriptions","organizations_url":"https://api.github.com/users/requests/orgs","repos_url":"https://api.github.com/users/requests/repos","events_url":"https://api.github.com/users/requests/events{/privacy}","received_events_url":"https://api.github.com/users/requests/received_events","type":"Organization","site_admin":false},"repo":{"id":6825724,"name":"requests-oauthlib","full_name":"requests/requests-oauthlib","owner":{"login":"requests","id":2805331,"avatar_url":"https://avatars.githubusercontent.com/u/2805331?v=3","gravatar_id":"","url":"https://api.github.com/users/requests","html_url":"https://github.com/requests","followers_url":"https://api.github.com/users/requests/followers","following_url":"https://api.github.com/users/requests/following{/other_user}","gists_url":"https://api.github.com/users/requests/gists{/gist_id}","starred_url":"https://api.github.com/users/requests/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/requests/subscriptions","organizations_url":"https://api.github.com/users/requests/orgs","repos_url":"https://api.github.com/users/requests/repos","events_url":"https://api.github.com/users/requests/events{/privacy}","received_events_url":"https://api.github.com/users/requests/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/requests/requests-oauthlib","description":"OAuthlib support for Python-Requests!","fork":false,"url":"https://api.github.com/repos/requests/requests-oauthlib","forks_url":"https://api.github.com/repos/requests/requests-oauthlib/forks","keys_url":"https://api.github.com/repos/requests/requests-oauthlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/requests/requests-oauthlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/requests/requests-oauthlib/teams","hooks_url":"https://api.github.com/repos/requests/requests-oauthlib/hooks","issue_events_url":"https://api.github.com/repos/requests/requests-oauthlib/issues/events{/number}","events_url":"https://api.github.com/repos/requests/requests-oauthlib/events","assignees_url":"https://api.github.com/repos/requests/requests-oauthlib/assignees{/user}","branches_url":"https://api.github.com/repos/requests/requests-oauthlib/branches{/branch}","tags_url":"https://api.github.com/repos/requests/requests-oauthlib/tags","blobs_url":"https://api.github.com/repos/requests/requests-oauthlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/requests/requests-oauthlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/requests/requests-oauthlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/requests/requests-oauthlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/requests/requests-oauthlib/statuses/{sha}","languages_url":"https://api.github.com/repos/requests/requests-oauthlib/languages","stargazers_url":"https://api.github.com/repos/requests/requests-oauthlib/stargazers","contributors_url":"https://api.github.com/repos/requests/requests-oauthlib/contributors","subscribers_url":"https://api.github.com/repos/requests/requests-oauthlib/subscribers","subscription_url":"https://api.github.com/repos/requests/requests-oauthlib/subscription","commits_url":"https://api.github.com/repos/requests/requests-oauthlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/requests/requests-oauthlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/requests/requests-oauthlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/requests/requests-oauthlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/requests/requests-oauthlib/contents/{+path}","compare_url":"https://api.github.com/repos/requests/requests-oauthlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/requests/requests-oauthlib/merges","archive_url":"https://api.github.com/repos/requests/requests-oauthlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/requests/requests-oauthlib/downloads","issues_url":"https://api.github.com/repos/requests/requests-oauthlib/issues{/number}","pulls_url":"https://api.github.com/repos/requests/requests-oauthlib/pulls{/number}","milestones_url":"https://api.github.com/repos/requests/requests-oauthlib/milestones{/number}","notifications_url":"https://api.github.com/repos/requests/requests-oauthlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/requests/requests-oauthlib/labels{/name}","releases_url":"https://api.github.com/repos/requests/requests-oauthlib/releases{/id}","created_at":"2012-11-23T10:19:44Z","updated_at":"2015-11-18T22:44:42Z","pushed_at":"2015-11-19T23:55:03Z","git_url":"git://github.com/requests/requests-oauthlib.git","ssh_url":"git@github.com:requests/requests-oauthlib.git","clone_url":"https://github.com/requests/requests-oauthlib.git","svn_url":"https://github.com/requests/requests-oauthlib","homepage":"https://requests-oauthlib.readthedocs.org/","size":296,"stargazers_count":492,"watchers_count":492,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":140,"mirror_url":null,"open_issues_count":30,"forks":140,"open_issues":30,"watchers":492,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/requests/requests-oauthlib/pulls/206"},"html":{"href":"https://github.com/requests/requests-oauthlib/pull/206"},"issue":{"href":"https://api.github.com/repos/requests/requests-oauthlib/issues/206"},"comments":{"href":"https://api.github.com/repos/requests/requests-oauthlib/issues/206/comments"},"review_comments":{"href":"https://api.github.com/repos/requests/requests-oauthlib/pulls/206/comments"},"review_comment":{"href":"https://api.github.com/repos/requests/requests-oauthlib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/requests/requests-oauthlib/pulls/206/commits"},"statuses":{"href":"https://api.github.com/repos/requests/requests-oauthlib/statuses/37f1e9b5b5583ff998ce295ab94b72e32beb236a"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":2,"deletions":0,"changed_files":1}}