首页 文章

Shopify API返回401 Unauthorized - Ruby on Rails

提问于
浏览
0

我已经创建了shopify合作伙伴应用 . 应用程序与商店成功连接 . 之后我在'orders / updated'上创建了webhook . 以下代码在webhook回调中,但Shopify API返回401 Unauzhorized .

url = request.headers['x-shopify-shop-domain'] # shop url
token = request.filtered_parameters["token"] # token from header
session = ShopifyAPI::Session.new(url, token) # create session
ShopifyAPI::Base.activate_session(session)
shop = ShopifyAPI::Shop.current # returns 401 Unauthorized

错误如下:

ActiveResource::UnauthorizedAccess (Failed.  Response code = 401.  Response message = Unauthorized.)

1 回答

相关问题