I want to use Eloqua's OAuth2.0. When I try to use it with "authorization_code" grant type it fails when generating accessToken and refreshToken with following error
{
"error": "invalid_grant",
"error_description": "The authorization code is incorrect, malformed, expired, or has been invalidated."
}
I am following steps at: https://docs.oracle.com/en/cloud/saas/marketing/eloqua-develop/Developers/GettingStarted/Authentication/authenticate-using-basic-auth.htm
Steps I followed:
Hit following url: https://login.eloqua.com/auth/oauth2/authorize?response_type=code&client_id=my-client-id&redirect_uri=https://www.google.com/&scope=full&state=xyz
I signed in using my creds and accepted the request
It then redirected to: https://www.google.com/?code=some-eloqua-server-side-generated-code&state=xyz
Then using postman I made the following request:
curl --location 'https://login.eloqua.com/auth/oauth2/token' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic base64-encoded-value-of-clientId:clientSecret-string' \
--header 'Cookie: culture=en-US' \
--data '{
"grant_type":"authorization_code",
"code":"some-eloqua-server-side-generated-code",
"redirect_uri":"https://www.google.com/"
}'
Anyone can help me with what could be the possible problem in my steps or the Eloqua OAuth2.0 just does not work(atleast with authorization_code grant_type)
I even did not see "invalid_grant" error anywhere in Eloqua's documentations.