我是否需要在Shopify应用卸载时手动销毁会话?

时间:2015-09-02 14:36:26

标签: ruby-on-rails shopify

我正在使用shopify_app gem。

当我安装我的应用程序,然后卸载,然后尝试重新安装时,会出现此问题。我从应用程序Oauth登录页面重定向到我登录的商店,其中包含“未找到应用程序”消息。

这让我相信在卸载应用程序时可能没有破坏会话数据,但我不知道如何解决这个问题。我假设我不需要webhook来销毁会话。

你能在我的设置中发现任何错误吗?

的routes.rb

Rails.application.routes.draw do


  scope '/hooks', :controller => :hooks do
    post :new_customer_callback
    post :app_uninstalled_callback
  end


  root :to => 'home#index'
  mount ShopifyApp::Engine, at: '/'

end



class SessionsController < ApplicationController
  include ShopifyApp::SessionsController
end


class AuthenticatedController < ApplicationController
  before_action :login_again_if_different_shop
  around_filter :shopify_session
  layout ShopifyApp.configuration.embedded_app? ? 'embedded_app' : 'application'
  helper_method :current_shop
end

shopify_session_repository.rb

if Rails.configuration.cache_classes
  ShopifyApp::SessionRepository.storage = 'Shop'
else
  ActionDispatch::Reloader.to_prepare do
    ShopifyApp::SessionRepository.storage = 'Shop'
  end
end

1 个答案:

答案 0 :(得分:1)

这只是一个想法。您是否在重新安装应用时没有更新访问令牌?

这是因为当您卸载时,访问令牌不再有效,您的应用仍可能尝试使用数据库中的旧访问令牌。