diff --git a/rowers/views/paymentviews.py b/rowers/views/paymentviews.py index 46462519..010b3cce 100644 --- a/rowers/views/paymentviews.py +++ b/rowers/views/paymentviews.py @@ -42,22 +42,19 @@ def rower_process_fakturoidcallback(request): base64_bytes = base64.b64encode(auth_string.encode('utf-8')) base64_string = base64_bytes.decode('utf-8') - authorizationstring = f"Basic {base64_string}" + authorizationstring = f"Basic {base64_bytes}" headers = { 'User-Agent': f"{FAKTUROID_APP_NAME} ({FAKTUROID_EMAIL})", 'Content-Type': 'application/json', 'Accept': 'application/json', - 'Authorization': authorizationstring, + 'Authorization': 'Basic %s' % base64.b64encode( + bytes(auth_string, 'utf-8')).decode('utf-8'), } - base_url = 'https://app.fakturoid.cz/api/v3/oauth/token' + base_url = 'https://app.fakturoid.cz/api/v3/oauth/token/' - auth = HTTPBasicAuth(FAKTUROID_CLIENT_ID, FAKTUROID_CLIENT_SECRET) - client = BackendApplicationClient(client_id=FAKTUROID_CLIENT_ID) - - oauth = OAuth2Session(client=client) - token = oauth.fetch_token(token_url=base_url, auth=auth) + response = requests.post(base_url, data=json.dumps(post_data), headers=headers) print(headers) print(post_data)