【问题标题】:How can I generate a password for a shopify app如何为 shopify 应用程序生成密码
【发布时间】:2015-11-17 11:26:16
【问题描述】:

按照documentation,这是我在控制台中测试的:

import os
import shopify

SHOPIFY_API_KEY = os.environ.get('SHOPIFY_API_KEY')
SHOPIFY_API_SECRET = os.environ.get('SHOPIFY_API_SECRET')
SHOPIFY_API_PASSWORD = '' # os.environ.get('SHOPIFY_API_PASSWORD')  # TODO: I don't have this

shop_url = "https://%s:%s@appappapp.myshopify.com/admin" % (SHOPIFY_API_KEY, SHOPIFY_API_PASSWORD)
shopify.ShopifyResource.set_site(shop_url)
shopify.Session.setup(api_key=SHOPIFY_API_KEY, secret=SHOPIFY_API_SECRET)
products = shopify.Product.find(limit=3)

我当然会得到:

pyactiveresource.connection.UnauthorizedAccess: Response(code=401, body="{"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}

我不知道如何生成密码。我的 shopify 连接通过 SHOPIFY_API_KEY / SHOPIFY_API_SECRET 与 django 集成,在会话中存储访问令牌。

在 URL https://app.shopify.com/services/partners/api_clients/<app-id> 中,我可以生成秘密和刷新令牌,但不能生成密码。

如何让它在控制台上运行?如何为 shopify 应用生成密码?

【问题讨论】:

    标签: python django shopify


    【解决方案1】:

    您无需生成 Shopify 密码。为合作伙伴应用安装应用所需的全部 API 密钥和秘密。

    您需要私有应用程序的 API 密钥和密码。 您需要合作伙伴应用的 API 密钥和密钥。

    基本上,您需要遵循这些步骤。

    1) setup your Shopify app using your API key and secret.
    
    2) setup the permission url by specifying your store and scope
    
    3) grab the values returned by the permission url in order to get your
    Shopify permanent token. (you get the token by doing a call using
    the params you got from step 2)
    
    4) use the token you have to make all your API calls
    

    【讨论】:

    • 当我想从控制台(没有 web 应用程序)进行测试时,这是否适用? shop_url 是"https://%s:%s@appappapp.myshopify.com/admin" % (SHOPIFY_API_KEY, SHOPIFY_API_PASSWORD),所以需要密码。能否请您展示一些关于如何使用您描述的方法实现连接到shopify的curl命令?
    • 您只需要私人应用程序的密码。当您在商店中创建私有应用程序时,它会提供给您。当您使用合作伙伴应用程序时,您不需要密码。 API Key 和 Secret 就足够了。
    猜你喜欢
    • 1970-01-01
    • 2016-06-23
    • 2020-02-24
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    • 2011-02-25
    • 2012-02-06
    • 1970-01-01
    相关资源
    最近更新 更多