2

I want to use OAuth2 authentication in my application for calling Eloqua APIs using access token.

I'm following instructions given in the link http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAB/Developers/GettingStarted/Authentication/authenticate-using-oau… and using Resource Owner Password Credentials grant flow for getting access token.

POST https://login.eloqua.com/auth/oauth2/token
Authorization: Basic Q09NUEFOWVhcdXNlcjE6cGFzc3dvcmQxMjM=
{
   "grant_type":"password",
   "scope":"full",
   "username":"testsite\\testuser",
   "password":"user123"
}

But I'm getting exception "java.net.ConnectException: Connection timed out: connect" while calling get token endpoint https://login.eloqua.com/auth/oauth2/token from java code.

I tried the endpoint using browser but getting similar error. Also tried accessing the endpoint using REST client but again same connection error.

I'm unable to understand that why the endpoint is giving connection timeout exception. I also tried increasing timeout but same error.

Please guide me as I'm stuck.

Is there any other endpoint for getting Eloqua access token?

Ash T
  • 21
  • 3

2 Answers2

2

Below is a POSTMAN Screenshot in case it helps. Also written out in case someday that screenshot isn't there. Don't use built in Auth in POSTMAN since you need to base64 encode the clientid:clientsecret with the : in the middle. These values are provided when you created an App in Eloqua.

Be sure to include the content type as application/json and the Authorization. Use a double backslash in the Json for the username in between the site and username (clientsite\\username).

JSON body should look like this: {"grant_type":"password","username":"clientsite\\username","password":"password"}

POSTMAN settings for Eloqua oAUTH 2.0 authentication

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
BrianTPG
  • 21
  • 3
0

Make sure you are doing a POST to login.eloqua.com/auth/oauth2/token

From the docs:

POST https://login.eloqua.com/auth/oauth2/token
Authorization: Basic Q09NUEFOWVhcdXNlcjE6cGFzc3dvcmQxMjM=
{
   "grant_type":"authorization_code",
   "code":"SplxlOBeZQQYbYS6WxSbIA",
   "redirect_uri":"https://client.example.com/cb"
}

From your request, it looks like you are missing the redirect_uri and the code. Try using the body contract from the docs: http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAB/index.html#Developers/GettingStarted/Authentication/authenticate-using-oauth.htm

Oscar Fraxedas
  • 4,467
  • 3
  • 27
  • 32