繁体   English   中英

“帐户登录不正确或您的帐户暂时被禁用。 请稍候,稍后再试。”}

[英]“The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.”}

我在 Magento 中为客户创建了一个用户。 我需要为客户创建一个登录 api。为此,我需要一个令牌来使用。要生成它,我使用了以下代码,最终出现以下错误。

{"message":"帐号登录不正确或您的帐号已被暂时停用。请稍后再试。"}

我的代码如下

    <?php

$userData = ["username" => "xxx@gmail.com", "password" => "xxx"];
$ch = curl_init("https://www.djbjsdjs.com/rest/V1/integration/customer/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));

$token = curl_exec($ch);
print_r($token);

首先,调用 /rest/default/V1/integration/customer/token 而不是 /index.php/rest/default/V1/integration/customer/token。

其次,确保您不调用映射的子域。 例如,如果您将 localhost 或 127.0.0.1 映射到 /etc/hosts 中的 mydomain.local,则不要调用http://mydomain.local/rest/default/V1/integration/customer/token ,而是在http 上调用: //127.0.0.1/rest/default/V1/integration/customer/token

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM