app/controllers/login_controller.rb
def finalize
    shopify_session = ShopifyAPI::Session.new(params[:shop], params[:t], params)
    if shopify_session.valid?
      session[:shopify] = shopify_session
      flash[:notice] = "Logged in to shopify store."

      # This creates the local shop object and stores its authentication string so that it can
      # used later in background tasks, etc.
      Shop.find_or_create_by_subdomain(:subdomain => session[:shopify].subdomain,
                                       :site => session[:shopify].site)
      
      return_address = session[:return_to] || '/home'
      session[:return_to] = nil
      redirect_to return_address
    else
      flash[:error] = "Could not log in to Shopify store."
      redirect_to :action => 'index'
    end
  end
# Shopify redirects the logged-in user back to this action along with
# the authorization token t.
# 
# This token is later combined with the developer's shared secret to form
# the password used to call API methods.
Shopify redirects the logged-in user back to this action along with
the authorization token t.

This token is later combined with the developer's shared secret to form
the password used to call API methods.
Shopify redirects the logged - in user back to this action along with the authorization token t . This token is later combined with the developer ' s shared secret to form the password used to call API methods .
def finalize
    shopify_session = ShopifyAPI::Session.new(params[:shop], params[:t], params)
    if shopify_session.valid?
      session[:shopify] = shopify_session
      flash[:notice] = "Logged in to shopify store."
      Shop.find_or_create_by_subdomain(:subdomain => session[:shopify].subdomain,
                                       :site => session[:shopify].site)
      return_address = session[:return_to] || '/home'
      session[:return_to] = nil
      redirect_to return_address
    else
      flash[:error] = "Could not log in to Shopify store."
      redirect_to :action => 'index'
    end
  end
def finalize shopify_session = ShopifyAPI :: Session . new ( params [ :shop ] , params [ :t ] , params ) if shopify_session . valid? session [ :shopify ] = shopify_session flash [ :notice ] = "Logged in to shopify store." Shop . find_or_create_by_subdomain ( :subdomain => session [ :shopify ] . subdomain , :site => session [ :shopify ] . site ) return_address = session [ :return_to ] || '/home' session [ :return_to ] = nil redirect_to return_address else flash [ :error ] = "Could not log in to Shopify store." redirect_to :action => 'index' end end
Shopify redirects the logged-in user back to this action along with
the authorization token t.
Shopify redirects the logged - in user back to this action along with the authorization token t .
# This creates the local shop object and stores its authentication string so that it can # used later in background tasks, etc.