LightSpeed Retail API - 如何获取临时令牌

时间:2018-04-03 22:11:11

标签: api oauth-2.0 lightspeed

我正在开发一个wordpress插件,它从Lightspeed Retail API获取某些产品信息。我按照文档http://developers.lightspeedhq.com/retail/authentication/access-token/

中的步骤进行操作

我有客户端ID和客户端密码,但我没有临时令牌,我现在卡住了,我确信我在这里错过了一些程序,你能帮助我吗?

这是我根据API文档使用的当前代码:

...

    $tokenURL = "https://cloud.lightspeedapp.com/oauth/access_token.php";
    $postFields = [
        'client_id' => 'XXXXXXXXXXXXX',
        'client_secret' => 'XXXXXXXXXXXXX',
        'code' => 'Temporary Token',
        'grant_type' => 'authorization_code'
    ];
...

1 个答案:

答案 0 :(得分:0)

如果您遵循instructions here,则会返回临时令牌。

您需要开始使用此URL:

https://cloud.lightspeedapp.com/oauth/authorize.php?response_type=code&client_id={client_id}&scope={scope}&state={state}

,将在您的应用接受代码/临时令牌后返回。