Ruby on rails Shopify::ActiveResource::禁止访问:失败。响应代码=403。响应消息=禁止

Ruby on rails Shopify::ActiveResource::禁止访问:失败。响应代码=403。响应消息=禁止,ruby-on-rails,shopify-app,Ruby On Rails,Shopify App,我已发送应用程序(尚未列出)以供审阅。审阅者在HomeController的索引操作中收到了提到的错误,当用户单击安装按钮时会触发该错误。我与不同合作伙伴帐户中的许多开发商店验证了该应用程序。我能够为我测试的所有商店成功安装该应用程序 下面是代码的简化版本 控制器/shopify/home\u controller.rb module Shopify class HomeController < ShopifyApp::AuthenticatedController def i

我已发送应用程序(尚未列出)以供审阅。审阅者在HomeController的索引操作中收到了提到的错误,当用户单击安装按钮时会触发该错误。我与不同合作伙伴帐户中的许多开发商店验证了该应用程序。我能够为我测试的所有商店成功安装该应用程序

下面是代码的简化版本

控制器/shopify/home\u controller.rb

module Shopify
  class HomeController < ShopifyApp::AuthenticatedController
    def index
      MyCustomServie.new(shopify_detail).call
    end

    private

    def current_shopify_store
      @current_shop ||= begin
        Shopify::Base.with_rate_limit_protection do
          ShopifyAPI::Shop.current
        end
      end
    end

    def shopify_detail
      @shopify_detail ||= ShopifyDetail.find_by(shopify_domain: current_shopify_store.try(:myshopify_domain))
    end
  end
end
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :shopify,
    ShopifyApp.configuration.api_key,
    ShopifyApp.configuration.secret,
    scope: ShopifyApp.configuration.scope,
    callback_path: "#{Settings.shopify.mounted_at}/auth/shopify/callback"

  provider :google_oauth2,
           Settings.google.client_id,
           Settings.google.client_secret,
          { access_type: "offline", approval_prompt: "" }
end
ShopifyApp.configure do |config|
  config.application_name = 'Shopify - Feed Champion'
  config.api_key = Settings.shopify.api_key
  config.secret = Settings.shopify.api_secret
  config.scope = Settings.shopify.scope
  config.embedded_app = true
  config.after_authenticate_job = { job: ShopifyAfterAuthenticateJob, inline: true }
  config.webhooks = [  Shopify::AppUninstalledWebhook::PARAMS  ]
end
conffig/initializers/shopify_app.rb

module Shopify
  class HomeController < ShopifyApp::AuthenticatedController
    def index
      MyCustomServie.new(shopify_detail).call
    end

    private

    def current_shopify_store
      @current_shop ||= begin
        Shopify::Base.with_rate_limit_protection do
          ShopifyAPI::Shop.current
        end
      end
    end

    def shopify_detail
      @shopify_detail ||= ShopifyDetail.find_by(shopify_domain: current_shopify_store.try(:myshopify_domain))
    end
  end
end
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :shopify,
    ShopifyApp.configuration.api_key,
    ShopifyApp.configuration.secret,
    scope: ShopifyApp.configuration.scope,
    callback_path: "#{Settings.shopify.mounted_at}/auth/shopify/callback"

  provider :google_oauth2,
           Settings.google.client_id,
           Settings.google.client_secret,
          { access_type: "offline", approval_prompt: "" }
end
ShopifyApp.configure do |config|
  config.application_name = 'Shopify - Feed Champion'
  config.api_key = Settings.shopify.api_key
  config.secret = Settings.shopify.api_secret
  config.scope = Settings.shopify.scope
  config.embedded_app = true
  config.after_authenticate_job = { job: ShopifyAfterAuthenticateJob, inline: true }
  config.webhooks = [  Shopify::AppUninstalledWebhook::PARAMS  ]
end
错误来自下一行
shopifigapi::Shop.current


这是你的电话号码。有人能指出问题出在哪里吗?

作为Shopify的新手,我错过了添加使用可用Shopify API所需的作用域,并且得到了相同的
禁止访问
错误。 在
shopify_app.rb
中,我添加了缺少的作用域。获取Shopify商店的所有产品和客户的示例:

config.scope=“阅读产品,阅读客户”


是所有可用范围的列表。

我不是Shopify专家。我一直在学习后端HTTP API是无状态的。因此,对于每个请求,如果执行该请求需要身份验证,则需要向api传递身份验证令牌。也许在您的请求中,您没有传递正确的身份验证令牌?同意,但其他人也应该面临同样的问题。问题是我们无法重新创建此问题。请与live Store联系我也在live site上尝试过。在那里我也无法复制。