获取Bing Ads API的刷新令牌 [英] Obtain Refresh Token for Bing Ads API

查看:113
本文介绍了获取Bing Ads API的刷新令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问Bing Ads API以获取我帐户的每日报告数据。 

I am attempting to access the Bing Ads API to get daily report data for my accounts. 

我有在此处概述的流程之后取得了部分成功: 

I have had partial success following the process as outlined here: 

https://msdn.microsoft.com/en-us/library/bing-ads-user-authentication-oauth-guide (v = msads.90).aspx

https://msdn.microsoft.com/en-US/library/dn632721.aspx



使用Index.php,ClientCredentials.php,get_data.php和OAuth2Callback.php我能够运行,登录然后获取访问代码。该邮件连同代码为: 

  实施代码以使用访问令牌检索数据: 

  EwBwAn ....



我可以使用此代码发出请求并下载报告,但它的到期时间很短,我希望请求refresh_token,所以我不必每次都登录。



我通过curl使用client_id,grant_type = aurthorization_code,redirect_uri,client_secret和来自的代码发出请求前一步。然而,响应是通用的"服务器错误"。如果我尝试更改param的名称,例如我得到更多
有用的错误,例如{" error":" invalid_request"," error_description":"提供的请求必须包含'代码'输入参数。"}。 
$


请求这个更长寿命的令牌时,我还需要注意一些其他元素吗?

https://msdn.microsoft.com/en-us/library/bing-ads-user-authentication-oauth-guide(v=msads.90).aspx
https://msdn.microsoft.com/en-US/library/dn632721.aspx

Using Index.php, ClientCredentials.php, get_data.php and OAuth2Callback.php I am able to run, login and then get an access code. The message along with codes is: 
 Implement code to retrieve data with access token: 
 EwBwAn.....

I can use this code to make a request and download a report for example but it has a short expiration time and I wish to request the refresh_token so I do not have to login each time.

I make a request via curl with client_id, grant_type=aurthorization_code, redirect_uri, client_secret and code from previous step. However the response is a generic "server error". If I attempt to change the name of a param for example I get a more helpful error such as {"error":"invalid_request","error_description":"The provided request must include a 'code' input parameter."}. 

Is there some other element I need to be aware of when requesting this longer life token?

推荐答案

如果运行代码示例,则应该已经在会话数据中具有刷新令牌。请参阅此代码段:

If you ran the code example, you should already have the refresh token in session data. Please see this snippet:

// If the response contains an access_token element, it was successful.
// If not, an error occurred and the description will be displayed below 
if(isset(


responseArray ['access_token']))
{
responseArray['access_token'])) {


accessToken =
accessToken =


这篇关于获取Bing Ads API的刷新令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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