Java示例。验证方法。 [英] Java examples. Authentication methods.

查看:79
本文介绍了Java示例。验证方法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我选择了最简单的示例https://msdn.microsoft.com/en-US/library/bing-ads-search-accounts-java-code-example.aspx。在该示例中具有以下访问属性:

用户名

密码

DeveloperToken

我有它们。开发人员令牌已升级为多用户。

但该示例不适用于这些属性。我收到消息:
$
AdApiError

代码:105

错误代码:InvalidCredentials

消息:身份验证失败。提供的凭据无效或帐户处于非活动状态。



然后我尝试了另一种方法。我在这个链接上运行代码https://msdn.microsoft.com/en-us/library/bing-ads-java-walkthrough-desktop-application.aspx,我获得了访问刷新令牌。然后我用这里描述的方法https://social.msdn.microsoft.com/Forums/en-US/375fbdce-2d69-4a21-bbcf-42a2f1663181/oath-authentication-to-bing-ads-api-using-the -java-API的作业没有的UI?论坛= BingAds。
我更改了原始代码示例并且它有效。我使用ClientId和RefreshToken而不是UserName和Password。

但是我仍然对使用UserName和Password运行该示例的可能性感兴趣。有人可以帮忙解决这个问题吗?

I chose the most simple example https://msdn.microsoft.com/en-US/library/bing-ads-search-accounts-java-code-example.aspx. In that example has the following access attributes:
UserName
Password
DeveloperToken
I'm have them. Developer token was upgraded to multi-user.
But that example does not working with these attributes. I get the message:
AdApiError
Code: 105
Error Code: InvalidCredentials
Message: Authentication failed. Either supplied credentials are invalid or the account is inactive.

Then I tried another method. I run the code at this link https://msdn.microsoft.com/en-us/library/bing-ads-java-walkthrough-desktop-application.aspx and I got access refresh token. Then I used the method described here https://social.msdn.microsoft.com/Forums/en-US/375fbdce-2d69-4a21-bbcf-42a2f1663181/oath-authentication-to-bing-ads-api-using-the-java-api-job-without-ui?forum=BingAds. I changed the original code example and it worked. I used ClientId and RefreshToken instead UserName and Password.
But I'm still interested in the possibility of to run that example using UserName and Password. Can anybody help with this?

推荐答案

有些示例显示了如何使用旧版的用户名和密码凭据。但是,如果您拥有Bing Ads的Microsoft帐户或电子邮件登录,则必须使用OAuth。在API的未来版本中,OAuth将是唯一接受的身份验证
方法,而UserName / Password身份验证将是日落。

Some of the examples show how to use the legacy UserName and Password credentials. However, if you have a Microsoft account or email login for Bing Ads, then you must use OAuth. In a future version of the API, OAuth will be the only accepted authentication method, and the UserName / Password authentication will be sunset.

对于
搜索帐户
您尝试过的示例 首先,您可以使用AuthenticationToken请求标头替换UserName和Password。浏览已经工作的OAuth流,并将AuthenticationToken设置为访问令牌的值。
欲了解更多信息,请参阅
使用OAuth管理用户身份验证

For the Search Accounts example that you tried first, you can replace UserName and Password with the AuthenticationToken request header. Go through the OAuth flow that you already got working, and set AuthenticationToken to the value of your access token. For more information, please see Managing User Authentication with OAuth.

致以最好的问候,

Eric


这篇关于Java示例。验证方法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆