Sha256: 9875b95fd8efc228219b606d0b496abd44f08b9e88e398e7456d5f86b1fa3256

Contents?: true

Size: 597 Bytes

Versions: 21

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

module ShopifyApp
  module WebhookVerification
    extend ActiveSupport::Concern
    include ShopifyApp::PayloadVerification

    included do
      skip_before_action :verify_authenticity_token, raise: false
      before_action :verify_request
    end

    private

    def verify_request
      data = request.raw_post
      unless hmac_valid?(data)
        ShopifyApp::Logger.debug("Webhook verification failed - HMAC invalid")
        head(:unauthorized)
      end
    end

    def shop_domain
      request.headers["HTTP_X_SHOPIFY_SHOP_DOMAIN"]
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
shopify_app-22.5.1 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.5.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.4.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.3.1 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.3.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.2.1 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.2.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.1.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.0.1 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-22.00.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.10.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.9.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.8.1 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.8.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.7.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.6.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.5.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.4.1 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.4.0 lib/shopify_app/controller_concerns/webhook_verification.rb
shopify_app-21.3.1 lib/shopify_app/controller_concerns/webhook_verification.rb