Java SDK通过OAuth进行身份验证 [英] Java SDK authenticate through OAuth

查看:80
本文介绍了Java SDK通过OAuth进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经能够通过用户名/密码凭证为JR自动化应用程序使用Bing Ads API。现在我想转移到OAuth。由于我找不到很多代码示例,我无法找到一个很好的方法。

I've been able to use Bing Ads API through username/password credential for java automation app. Now i am trying to move over to OAuth. I couldn't figure out a good way to get this to work as there is not many code example I could find. 

我正在尝试启动此对象  OAuthDesktopMobileAuthCodeGrant  &替换的的PasswordAuthentication。
第一步是" 通过网络浏览器控件请求用户同意然后
"
将通过Microsoft帐户提示用户授权网页浏览器控件"。
Java SDK会以某种方式支持吗?或者我需要实现"类似浏览器"控制伪造这些步骤?我希望这应该像从主帐户请求(永久)令牌并使用它一样简单。这是一个
自动化工具,我们不必使用用户名/密码凭证来执行API请求。请指教

I am trying to initiate this object OAuthDesktopMobileAuthCodeGrant replacing PasswordAuthentication. The first step is "Request user consent through a web browser control" and then "The user will be prompted through the Microsoft Account authorization web browser control ". Would the Java SDK support this somehow? Or I need to implement a "browser like" control to fake these steps? I was hoping that this should be as easy as requesting a (permanent) token from the master account and use it. Again this is an automation tool, we just don't have to use the username/password credential to do the API requests. Please advise

谢谢

推荐答案

您好。


使用OAuth
"Java入门"指南提供了OAuth可用SDK类的高级视图,并包含一个简短的Web应用程序示例。听起来你想要设置一个无人值守的控制台应用程序,这是正确的吗?在这种情况下,
你可以从 $ b开始$ b演练:使用Java的Bing Ads桌面应用程序。您需要实施网络浏览器控件以确保初始用户同意(即使您允许应用程序同意访问您自己的Bing Ads帐户),然后可以使用刷新令牌
来获取后续访问令牌。

The Using OAuth section of the Getting Started in Java guide provides a high level view of available SDK classes for OAuth, and contains a short web app example. It sounds like you want to set up an unattended console app, is that correct? In that case you can start with the Walkthrough: Bing Ads Desktop Application in Java. You will need to implement a web browser control to secure the initial user consent (even if you are giving your app consent to access your own Bing Ads accounts), and thereafter can use the refresh token to get subsequent access tokens.

如果您有任何其他问题,请与我们联系。

Please reach out if you have any further questions.

我希望这有帮助!


这篇关于Java SDK通过OAuth进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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