Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.

Commit b63f078

Browse files
author
Adil Asim
authored
Fix exchange_code_for_access_token.
Fixes "instagram.oauth2.OAuth2AuthExchangeError: You must provide a client_id" error Reference: facebookarchive#249. All credit goes to yousong.
1 parent 518ca9c commit b63f078

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

instagram/oauth2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def exchange_for_access_token(self, code=None, username=None, password=None, sco
109109
data = self._data_for_exchange(code, username, password, scope=scope, user_id=user_id)
110110
http_object = Http(disable_ssl_certificate_validation=True)
111111
url = self.api.access_token_url
112-
response, content = http_object.request(url, method="POST", body=data)
112+
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
113+
response, content = http_object.request(url, method="POST", headers=headers, body=data)
113114
parsed_content = simplejson.loads(content.decode())
114115
if int(response['status']) != 200:
115116
raise OAuth2AuthExchangeError(parsed_content.get("error_message", ""))

0 commit comments

Comments
 (0)