Problem integrating omniauth-shopify-oauth2 with devise omniauthable

118 views
Skip to first unread message

司徒朝鹄

unread,
Jul 12, 2016, 2:49:21 PM7/12/16
to Devise
Hi everyone, I have a project that uses omniauth-shopify-oauth2 with devise. Works well if these two doesn't interact. However, if I add :omniauthable to devise, then omniauth-shopify-oauth2 stops working entirely. I figure it is because the config needs to move from omniauth.rb to devise.rb, so I updated the devise rb file to include:
shopify_options = {
  :scope => 'read_products,read_orders,write_content',
  :setup => lambda { |env|
    params = Rack::Utils.parse_query(env['QUERY_STRING'])
    env['omniauth.strategy'].options[:client_options][:site] = "https://#{params['shop']}"
  }
}
config.omniauth :shopify, ENV['SHOPIFY_API_KEY'], ENV['SHOPIFY_SHARED_SECRET'], shopify_options

With the form to shopify:
= form_tag "/auth/shopify", method: 'get' do
  = label_tag :shop, "Your shop's .myshopify.com domain:"
  = text_field_tag :shop
  = submit_tag "Submit"

This tries to reach "http://localhost:4000/auth/shopify?utf8=%E2%9C%93&shop=sponsorsone.myshopify.com&commit=Submit". resulting in

No route matches [GET] "/auth/shopify"

I don't know if I'm using devise with omniauth-shopify-oauth2 correctly. Any ideas?
I also found this: "https://github.com/Shopify/shopify_app/issues/149". Should I just move away from using omniauthable?
Reply all
Reply to author
Forward
0 new messages