我已发送应用程序(尚未列出)以供审核。审阅者在HomeController的索引操作上获得了上述错误,当用户单击安装按钮时会触发该错误。我在不同的合作伙伴帐户中验证了许多开发商店的应用。我能够为我测试的所有商店成功安装应用程序。
以下是代码的简化版本
控制器/ shopify / home_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
配置/初始化/ omniauth.rb
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
conffig /初始化/ shopify_app.rb
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
错误来自以下行
ShopifyAPI::Shop.current
这是error log。任何人都可以指出哪里可能是问题?
答案 0 :(得分:1)
作为Shopify的新手,我错过了添加使用可用Shopify API所需的范围的信息,并且遇到了相同的ForbiddenAccess
错误。
在shopify_app.rb
中,我添加了缺少的范围。获取Shopify商店的所有产品和客户的示例:
config.scope =“ read_products,read_customers”
Here是所有可用范围的列表。