jwt-auth icon indicating copy to clipboard operation
jwt-auth copied to clipboard

TypeError after installing 1.4.0 + IDE Helper

Open renatop7 opened this issue 3 years ago • 1 comments

Subject of the issue

TypeError 

  Lcobucci\JWT\Signer\Key\InMemory::plainText(): Argument #1 ($contents) must be of type string, null given, called in /Users/renatop/projects/csdl/api/vendor/php-open-source-saver/jwt-auth/src/Providers/JWT/Lcobucci.php on line 88

  at vendor/lcobucci/jwt/src/Signer/Key/InMemory.php:30
     26▕     {
     27▕         return new self('', '');
     28▕     }
     29▕ 
  ➜  30▕     public static function plainText(string $contents, string $passphrase = ''): self
     31▕     {
     32▕         return new self($contents, $passphrase);
     33▕     }
     34▕ 

      +50 vendor frames 
  51  artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script php artisan ide-helper:generate handling the post-update-cmd event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Your environment:

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 8.x
Package version 1.4.0
PHP version 8.1.0

Steps to reproduce

With Laravel 8 and IDE helper installed

composer require php-open-source-saver/jwt-auth

Expected behaviour

post-update-cmd hook doen't fail

Actual behaviour

Error above is displayed

renatop7 avatar Jan 22 '22 01:01 renatop7

From the information given, I derive your are using symmetric algorithm but not providing a secret?

Maybe this is trigger due to recent code changes, but we need to make sure your config is in order. In your config/jwt.php:

  • are you defining a 'secret'?
  • which 'algo' are you using?

(would be great if you can dump you whole config/jwt.php but make sure it does not contain secrets ❗ )

mfn avatar Jan 22 '22 20:01 mfn

@renatop7 any update on this? Otherwise we can close the issue

eschricker avatar Aug 16 '22 07:08 eschricker

@eschricker I gave up and started using Laravel Sanctum for authentication. So I don't have any updates on this, sorry. I think you can close the issue, maybe was something wrong with my setup because nobody else had this problem.

renatop7 avatar Aug 16 '22 13:08 renatop7

@renatop7 thanks for your quick reply. I close the issue

eschricker avatar Aug 16 '22 14:08 eschricker