如何通过php中为oauth形成的url获取代码 [英] How to get code through the url in formed in php for oauth

查看:109
本文介绍了如何通过php中为oauth形成的url获取代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此链接:
$


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



$
我需要它在没有用户互动的情况下运行所以当我在index.php中时你需要b $ b $

I am using this link:

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


I need it to run without user interaction so when I have in index.php 

    $goToUrl = $authorizationUrlBase . '?' . http_build_query($queryParams);






我怎么用这个来获取php中的代码?我已使用

确认测试目的。



what do I do with this to get the code in php? I have checked for testing purpose using

    header("Location:" .$goToUrl);






它在网址中有`code`但如果我在php中使用上面的代码行,它就会卡在新窗口中。 
$


我该如何处理?我不需要在任何地方重定向就可以获取`code`值。



**我需要它在没有用户交互的情况下运行,因为它需要作为cron运行工作。我正在使用Bing ads api。 



$



that it has `code` in the url formed but if I use above line of code in php, it gets stuck at the new window. 

How do I deal with this? I do I fetch that `code` value without having to redirecting anywhere.

**I need it to run without user interaction since it needs to be run as a cron job. I am using Bing ads api. 



推荐答案

您好。

预先需要用户交互和授权。此后,您可以使用刷新令牌(无需用户交互)来请求新的访问+刷新令牌。有关详细信息,请参阅

通过授权代码授予流程管理用户身份验证

User interaction and authorization is required once upfront. Thereafter you can use the refresh token (without user interaction) to request a new access + refresh token. For more details please see Managing User Authentication via Authorization Code Grant Flow.

请与任何后续问题联系。

Please reach out with any follow up questions.

Eric


这篇关于如何通过php中为oauth形成的url获取代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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