Shopee Open Platform API始终响应“无效令牌". [英] Shopee Open Platform API always response "Invalid token"

查看:225
本文介绍了Shopee Open Platform API始终响应“无效令牌".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果能将您带到这里,我感到很抱歉,我谈论的是一个平台,尽管该平台的特色是在广告中跳舞的知名人士,但这个平台在世界范围内并不是非常知名.

I'm sorry in advance if something bring you here and I talk about a platform that's not really well-known over the world despite featuring a well-known person dancing in their commercial.

我谈论的是Shopee开放平台API.我试图在这里非常正确地遵循他们的指示.

It's Shopee Open Platform API I talk about. I was trying to follow very properly their instruction here.

https://open.shopee.com/documents?module = 63& type = 2& id = 51

但在步骤5:商店授权中立即陷入困境.首先,给我一个测试伙伴ID,一个测试密钥,并且我需要手动设置测试重定向URL.我必须从所有给定信息生成授权令牌.首先,我需要通过将测试密钥与URL的URI组件编码的字符串连接来创建令牌基础字符串.变成这样的东西.

But stuck instantly at step 5 : Shop Authorization. First, I've been given a test partner id, a test key, and I need to set manually the test redirect URL. I have to generate authorization token from all given information. Firstly I need to create a token base string by concatenating the test key with URI component encoded string of the URL. It turns into something like this.

9b754aca01a5d719cb70c5778294dae6ff90fcc68c82908ee480a36ff901d181https%3A%2F%2Fwww.unwelldocumented.com

9b754aca01a5d719cb70c5778294dae6ff90fcc68c82908ee480a36ff901d181https%3A%2F%2Fwww.unwelldocumented.com

要生成授权令牌,它说我需要做 hexencode(sha256(token_base_string)).它返回了一个很长的整数.

To generate the authorization token, it says I need to do hexencode(sha256(token_base_string)). It returned a very long integer.

32373935663639356636346266266137137613465396239383361373334646133656530313333393762762138396364663037366566313366313436316534534761

32373935663639356636346266303137613465396239383361373334646133656530313333393762636138396364663037366566313366313436316534303761

所以我只是假设一切都很好,那就是授权令牌.但是当我发送这个...

So I just assumed everything is fine and that is the authorization token. But when I send this...

https://partner.uat.shopeemobile.com/api/v1/shop/auth_partner?id=(test_partner_id)& token =(authorization_token)& redirect =(test_redirect_URL)

...突然我明白了

{
    "error": "error_auth",
    "msg": "Invalid token",
    "request_id": "30a4b6b0074541bdd88260a33f155ca6"
}

推荐答案

为了解决此问题,您必须了解SHA256是加密哈希函数.请针对您的特定语言对SHA256进行更多研究.对于这种非常特殊的情况,您的SHA256令牌应如下所示.

In order to solve this, you have to understand that SHA256 is an Encryption hash function. Please research more on SHA256 on your specific language. For this very specific case, your SHA256 token should be as below.

在SHA256之前:

9b754aca01a5d719cb70c5778294dae6ff90fcc68c82908ee480a36ff901d181https%3A%2F%2Fwww.unwelldocumented.com

9b754aca01a5d719cb70c5778294dae6ff90fcc68c82908ee480a36ff901d181https%3A%2F%2Fwww.unwelldocumented.com

SHA256之后:

2795f695f64bf017a4e9b983a734da3ee013397bca89cdf076ef13f1461e407a

2795f695f64bf017a4e9b983a734da3ee013397bca89cdf076ef13f1461e407a

其余步骤似乎正确.

这篇关于Shopee Open Platform API始终响应“无效令牌".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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