Skip to content

Commit

Permalink
Fix exchange_code_for_access_token.
Browse files Browse the repository at this point in the history
Fixes "instagram.oauth2.OAuth2AuthExchangeError: You must provide a client_id" error

Reference: facebookarchive#249. All credit goes to yousong.
  • Loading branch information
Adil Asim authored Apr 13, 2017
1 parent 518ca9c commit b63f078
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion instagram/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def exchange_for_access_token(self, code=None, username=None, password=None, sco
data = self._data_for_exchange(code, username, password, scope=scope, user_id=user_id)
http_object = Http(disable_ssl_certificate_validation=True)
url = self.api.access_token_url
response, content = http_object.request(url, method="POST", body=data)
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
response, content = http_object.request(url, method="POST", headers=headers, body=data)
parsed_content = simplejson.loads(content.decode())
if int(response['status']) != 200:
raise OAuth2AuthExchangeError(parsed_content.get("error_message", ""))
Expand Down

0 comments on commit b63f078

Please sign in to comment.