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

Disable JWT authentication on console requests #14

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jackatomix
Copy link

Description

Previously the plugin would initialize itself on application load. This is fine, but Craft::$app may be either a craft\web\Application or a craft\console\Application, which are different applications with different use cases.

As seen in #11, this would cause all console requests to crash as the console application resolves a console request, and there is no craft\console\Request::headers.

This PR changes the class that the plugin initialzes on from Craft->$app to craft\web\Application, causing the plugin to not attempt to authenticate a user based on the current headers on console requests.

Definition of Done

  • Ensure there are no formatting errors
  • Ensure feature branch has latest development code integrated
  • Version number in composer.json is updated
  • New entry added in CHANGELOG.md documenting changes made

@jackatomix jackatomix changed the title Hotfix console headers Disable JWT authentication on console requests Aug 27, 2020
@BenMenking
Copy link

BenMenking commented Feb 4, 2021

I'm running into this issue too. Manually changing the code using this PR fixes the issue for me. This issue occurred after upgrading to CraftCMS 3.6.3

Copy link

@uwaeae uwaeae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is working for me

Copy link

@bmenking-wng bmenking-wng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrects the error. Tested on CraftCMS 3.5 and 3.6

Copy link

@bmenking-wng bmenking-wng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes were tested on 3.7.x and confirmed working.

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

Successfully merging this pull request may close these issues.

4 participants