Eloqua OAuth2身份验证获取令牌URL无法访问

时间:2016-05-18 13:37:08

标签: oauth-2.0 eloqua

我想在我的应用程序中使用OAuth2身份验证来使用访问令牌调用Eloqua API。

我按照链接http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAB/Developers/GettingStarted/Authentication/authenticate-using-oau中的说明操作...并使用资源所有者密码凭据授予流程获取访问令牌。

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

但是我得到了异常" java.net.ConnectException:连接超时:连接"从java代码调用get token endpoint https://login.eloqua.com/auth/oauth2/token时。

我使用浏览器尝试了端点但得到了类似的错误。还尝试使用REST客户端访问端点,但同样连接错误。

我无法理解端点为什么会给出连接超时异常。我也试过增加超时但同样的错误。

请引导我,因为我被卡住了。

是否有其他端点可以获取Eloqua访问令牌?

2 个答案:

答案 0 :(得分:2)

以下是POSTMAN屏幕截图,以防它有帮助。 如果某天截图还没有在那里写出来的话。不要在POSTMAN中使用内置的Auth,因为你需要使用以下内容对clientid:clientsecret进行base64编码。在Eloqua中创建应用程序时会提供这些值。

确保将内容类型包含为application / json和Authorization。在Json中使用双反斜杠作为站点和用户名之间的用户名(clientsite\\username)。

JSON正文应如下所示: {"grant_type":"password","username":"clientsite\\username","password":"password"}

POSTMAN settings for Eloqua oAUTH 2.0 authentication

答案 1 :(得分:0)

确保您正在执行POSTlogin.eloqua.com/auth/oauth2/token

来自文档:

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

根据您的请求,您似乎错过了 redirect_uri 代码。 尝试使用文档中的正文合约:http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAB/index.html#Developers/GettingStarted/Authentication/authenticate-using-oauth.htm

相关问题