Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWTMiddleware warns/decodes tokens excessively #1567

Closed
ghost opened this issue Nov 3, 2022 · 2 comments · Fixed by #1610
Closed

JWTMiddleware warns/decodes tokens excessively #1567

ghost opened this issue Nov 3, 2022 · 2 comments · Fixed by #1610
Labels

Comments

@ghost
Copy link

ghost commented Nov 3, 2022

Description

JWTMiddleware warns excessively for our application because we have non-Shopify endpoints that include HTTP_AUTHORIZATION headers. We aren't mounting the ShopifyApp::Engine so I was surprised to find that any decoding was happening at all. Can the decoding be restricted to just Shopify endpoints somehow or be disabled by configuration?

Steps to Reproduce

  1. Install shopify_app gem
  2. Make an API call with an HTTP AUTHORIZATION header that's not from Shopify

Expected behavior:

Non-Shopify calls are ignored

Actual behavior:

A warning is logged: [ShopifyApp::JWT] Failed to validate JWT: [JWT::DecodeError] Not enough or too many segments

Reproduces how often:

100%

Gem versions

21.2.0

@ghost ghost added the bug label Nov 3, 2022
@ghost
Copy link
Author

ghost commented Nov 3, 2022

If anyone else needs a workaround for this that is not actually using the JWTMiddleware you can add this to your config/application.rb:

    config.before_initialize do
      config.middleware.delete ShopifyApp::JWTMiddleware
    end

@klenotiw
Copy link
Contributor

Thanks for the feedback! We decided it was best to just remove this log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant