As documented here and here once I obtain my "code": "<THE_AUTHORIZATION_CODE_YOU_WERE_GIVEN>"
after hitting the authorization endpoint with the proper payload (which I have done, and this payload requires the redirect_uri
) I then want to call the obtain token endpoint.
My call is like so:
r = requests.post(
url='https://connect.squareupsandbox.com/oauth2/token', # dev
headers=SQUARE['HEADERS'],
data={
"client_id": SQUARE['APP_ID'],
"client_secret": SQUARE['APP_SECRET'],
"code": authorization_code,
"grant_type": "authorization_code"
}
)
this is using standard Python requests
lib and mirrors the documented payload (copying from Square docs):
curl https://connect.squareupsandbox.com/oauth2/token \
-X POST \
-H 'Square-Version: 2021-05-13' \
-H 'Content-Type: application/json' \
-d '{
"client_id": "<YOUR_APPLICATION_ID>",
"client_secret": "<YOUR_APPLICATION_SECRET>",
"code": "<THE_AUTHORIZATION_CODE_YOU_WERE_GIVEN>",
"grant_type": "authorization_code"
}'
however in response I get an error:
{'code': 'MISSING_REQUIRED_PARAMETER', 'detail': "missing required parameter 'redirect_uri'", 'category': 'INVALID_REQUEST_ERROR'}
i also validate the same error in my terminal using curl
explicitly matching documented payload, substituting in my correct authorization_code
by pulling it from my python terminal after printing it from the redirect handler…
so i don’t get it because redirect_uri
is not required for this endpoint? and it wouldn’t make sense here?
what am i doing wrong?
15 posts - 3 participants