使用Web API中的OAuth访问Bing Ads API [英] Accessing Bing Ads API using OAuth from Web API

查看:83
本文介绍了使用Web API中的OAuth访问Bing Ads API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Web API应用程序,用于向Bing Ads API发出请求。我正在尝试实施OAuth 2. 我不明白如何验证"用户"。来自API环境,因为没有用于放置OAuth
登录的网页。

I have an ASP.NET Web API application that I use to make requests to the Bing Ads API. I'm trying to implement OAuth 2.  I do not understand how to authenticate a "user" from an API environment since there is no web page to place the OAuth sign-in on.

我正在使用授权代码授权流程,但是,在每个示例中我看到,请求来自桌面应用程序或网站,而不是来自"无UI"的请求。应用程序就像一个API。



如果有人能指出我应该如何实现它的一个例子(再次,使用Web API应用程序,没有UI)将是一个巨大的帮助。

I'm using the authorization code grant flow, however, in every example I see, the requests come from either a desktop application or a website, not a "UI-less" application like an API.

If someone could point me to an example of how this should be implemented (again, using a Web API app, nothing with a UI) that would be a HUGE help.

非常感谢您的帮助。

推荐答案

好问题。必须通过UI提示授予初始同意。此后,您可以使用刷新令牌在后台运行应用程序,即"无UI"。又名"无头"。有关详细信息,请参阅有关
的文档
授权代码授予流程
。作为此方案的最佳实践,您应该注册一个Web应用程序(非本机)。 

Good question. Initial consent must be granted through the UI prompt. Thereafter you can use a refresh token to run the app in the background aka "UI-less" aka "headless". For more details see the doc about Authorization Code Grant Flow. As a best practice for this scenario you should register a Web app (not Native). 

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

Please reach out if you have any follow up questions.

我希望这有帮助,

Eric


这篇关于使用Web API中的OAuth访问Bing Ads API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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