Bing Ads Token会立即过期 [英] Bing Ads Token is immediately expired

查看:114
本文介绍了Bing Ads Token会立即过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个奇怪的问题,我希望有人可以帮助我。我正在尝试在PHP中集成Offline Conversions。我通过了OAuth令牌刷新,它正确地检索了一组新的令牌。

 $ authentication =(new OAuthDesktopMobileAuthCodeGrant())
- > withClientId ($ creds ['client_id'])
- > withRedirectUri('https://login.live.com/oauth20_desktop.srf');

$ this-> authorizationData =(new AuthorizationData())
- > withAuthentication($ authentication)
- > withAccountId($ creds ['account_id'])
- > withCustomerId($ creds ['customer_id'])
- > withDeveloperToken($ creds ['developer_token']);

$ client = new ServiceClient(
ServiceClientType :: CampaignManagementVersion11,
$ this-> authorizationData,
$ creds ['environment']
) ;

$ this-> authorizationData-> Authentication-> RequestOAuthTokensByRefreshToken($ creds ['refresh']);
$ client-> SetAuthorizationData($ this-> authorizationData); //以防万一,这应该没关系,我已经两种方式运行




我已检查过令牌是否已成功收到。我正在保存刷新令牌然后我打电话


 

$ response = $ client-> GetService() - > ApplyOfflineConversions($ request);


并收到此错误。

无效的客户数据。检查SOAP故障详细信息以获取更多信息

AdApiFaultDetail:{" TrackingId":" 337f096e-be37-4bfd-aefa-7eb5361f8a33"," Errors":{" AdApiError":{" ;代码":"" 109","Detail":null,"ErrorCode":"AuthenticationTokenExpired","Message":"验证令牌已过期。请续订或获取新令牌。"}}}

重试OAuth刷新令牌会出现同样的错误,有时会出现内部错误服务器错误。


我在这里做错了什么?这似乎应该可行。






< style type =" text / css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px;字体:12.0px'Helvetica Neue';颜色:#454545} p.p2 {margin:0.0px 0.0px 0.0px 0.0px;字体:12.0px'Helvetica Neue';颜色:#454545; min-height:14.0px}< / style>

解决方案

您知道

中刷新令牌的年龄吗

creds [ '刷新']?根据
OAuth指南
,而刷新令牌参数不有一个明确的有效期,你应该期望它持续几个月。作为最佳实践,刷新令牌应设置为检索到的最新刷新令牌的值。


如果您仍然被阻止,那么我建议您请求用户同意(重新开始)以获得全新的访问权限并刷新令牌。 


我希望这会有所帮助,


Eric


Having a weird issue that I'm hoping someone can help me with. I'm trying to integrate Offline Conversions in PHP. I go through the OAuth token refresh, which retrieves a new set of tokens correctly.

$authentication = (new OAuthDesktopMobileAuthCodeGrant())
                ->withClientId($creds['client_id'])
                ->withRedirectUri( 'https://login.live.com/oauth20_desktop.srf');

$this->authorizationData = (new AuthorizationData())
            ->withAuthentication($authentication)
            ->withAccountId($creds['account_id'])
            ->withCustomerId($creds['customer_id'])
            ->withDeveloperToken( $creds['developer_token']);

$client = new ServiceClient(
    ServiceClientType::CampaignManagementVersion11,
    $this->authorizationData,
    $creds['environment']
);

$this->authorizationData->Authentication->RequestOAuthTokensByRefreshToken($creds['refresh']);
$client->SetAuthorizationData($this->authorizationData); //Just in case, this shouldn't matter, and I've run it both ways

I've checked that the tokens are being received successfully. I'm saving off the Refresh Token and then I call

$response = $client->GetService()->ApplyOfflineConversions($request);

and get this error.

Invalid client data. Check the SOAP fault details for more information

AdApiFaultDetail: {"TrackingId":"337f096e-be37-4bfd-aefa-7eb5361f8a33","Errors":{"AdApiError":{"Code":"109","Detail":null,"ErrorCode":"AuthenticationTokenExpired","Message":"Authentication token expired. Please renew it or obtain a new token."}}}

Retrying the OAuth refresh token gives the same error, or sometimes an Internal Server Error.

What am I doing wrong here? This seems like it should work.



<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545; min-height: 14.0px} </style>

解决方案

Do you know the age of the refresh token at


creds['refresh']? Per the OAuth guide, whereas the refresh token parameter does not have a defined expiration period, you should expect it to last several months. As a best practice the refresh token should be set to the value of the most recent refresh token retrieved.

If you are still blocked then I suggest you request user consent (start over) to get brand new access and refresh tokens. 

I hope this helps,

Eric


这篇关于Bing Ads Token会立即过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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