Using new Oauth2 endpoint to get Access Token--400 error
So far in our Constant Contact integration, we have been successful with the older 'idfed' Oauth2 endpoint for retrieving access tokens with a POST. Ā However, during the maintenance outage yesterday learned that we had to switch to use a new 'authz' endpoint by March 31st, very surprising to hear of this.
Ā
So far, in trying to adapt to using the new 'auth' endpoint, we get 400 errors in testing.
Ā
I have this POST:
https://authz.constantcontact.com/oauth2/default/v1/token?code=AUTHCODE&redirect_uri=URI&state=STATE_ENCODED_VALUE&nonce=NONCE_ENCODED_VALUE&grant_type=authorization_code
Ā
(the UPPERCASE values hide the actual values)
Ā
to which the response is a 400 error.
Ā data: {
Ā Ā Ā errorCode: 'E0000021',
Ā Ā Ā errorSummary: 'Bad request.Ā Accept and/or Content-Type headers likely do not match supported values.',
Ā Ā Ā errorLink: 'E0000021',
Ā Ā Ā errorId: 'oaeEf5o-pigQ0Cqtj6gey4rCA',
Ā Ā Ā errorCauses: []
Ā Ā }
Ā
Looking at the message about the Accept or Content-Type headers, I checked what was being sent:
Ā 'Accept: application/json, text/plain, */*\r\n' +
Ā 'Content-Type: application/json;charset=utf-8\r\n' +
Ā
Note that these values for Accept and Content-Type headers are unchanged from what was being sent to the old 'idfed' endpoint.
The only changes to the new endpoint were copying the API Key and getting a new client secret per the instructions on migrating to the new endpoints, encoding these in the Authorization header, changing the URL and adding the state and nonce query parameters.Ā
Ā
Any thoughts on what might be the issue?Ā
I've been following these instructions: Ā
Ā Ā Ā Ā
Ā