[英]PHP Oauth gets 401 on PHP 7.3, ok on PHP 7.2 and earlier
I'm trying to use PHP's Oauth module to interact with Etsy's API.我正在尝试使用 PHP 的Oauth 模块与 Etsy 的 API 进行交互。
Following Etsy's docs , I have按照Etsy 的文档,我有
<?php
if (!extension_loaded('oauth')) {
throw new Exception('Oauth not loaded.');
}
$oauth = new OAuth("foobar-key", "foobar-secret");
$req_token = $oauth->getRequestToken(
"https://openapi.etsy.com/v2/oauth/request_token?scope=email_r%20listings_r",
"oob",
"GET"
);
This works fine when run with php7.2:使用 php7.2 运行时效果很好:
php7.2 etsy-oauth.php
...
OK
When the same is run with php7.3, though, I get a 401:但是,当使用 php7.3 运行相同的程序时,我得到 401:
php7.3 etsy-oauth.php
...
PHP Fatal error: Uncaught OAuthException: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
oauth_problem=signature_invalid
OAuth is definitely installed for both PHP 7.2 and PHP 7.3, as confirmed by the extension_loaded
above, and by: OAuth 肯定是为 PHP 7.2 和 PHP 7.3 安装的,正如上面的extension_loaded
和通过:
php7.2 -m | grep OAuth
OAuth
php7.3 -m | grep OAuth
OAuth
I haven't been able to find any documented difference in how this same call should be made in PHP 7.3 vs PHP 7.2.在 PHP 7.3 与 PHP 7.2 中应该如何进行相同的调用,我无法找到任何记录在案的差异。
How should this Oauth call be made correctly in PHP 7.3?这个 Oauth 调用应该如何在 PHP 7.3 中正确进行?
I had same problem in php7.3.我在php7.3中遇到了同样的问题。 Try to install OAuth 2.0.5.尝试安装 OAuth 2.0.5。 It work for me它对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.