Search code examples
laravellaravel-passport

It was not possible to parse your key, Error in Laravel v6


I'm using Laravel v6.2, passport v9.2. On local host its working perfect creating not even a single issue. When I deployed code on production server, it started created problem, it's giving error. I matched, php version is also same on production server. but error is only producing on production not local, while code and every thing is same on both. I searched and found that I should update passport but for this I also need to update laravel version, for some reason I don't want to update laravel.

Can anyone help me how to solve this problem?

Log:

InvalidArgumentException {#1726
 #message: "It was not possible to parse your key, reason: "
  #code: 0
  #file: "/var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php"
  #line: 90
  trace: {
    /var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:90 {}
    /var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:47 {}
    /var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:21 {}
    /var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/BaseSigner.php:36 {}
    /var/www/quickxi-food/vendor/lcobucci/jwt/src/Builder.php:470 {}
    /var/www/quickxi-food/vendor/lcobucci/jwt/src/Builder.php:450 {}
    /var/www/quickxi-food/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php:53 {}
    /var/www/quickxi-food/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php:61 {}
    /var/www/quickxi-food/vendor/league/oauth2-server/src/ResponseTypes/BearerTokenResponse.php:31 {}
    /var/www/quickxi-food/vendor/league/oauth2-server/src/AuthorizationServer.php:202 {}
    /var/www/quickxi-food/vendor/laravel/passport/src/PersonalAccessTokenFactory.php:116 {}
    /var/www/quickxi-food/vendor/laravel/passport/src/PersonalAccessTokenFactory.php:71 {}
    /var/www/quickxi-food/vendor/laravel/passport/src/HasApiTokens.php:67 {}
    /var/www/quickxi-food/app/Http/Controllers/ApiController/AuthController.php:64 {
      App\Http\Controllers\ApiController\AuthController->login(Request $request, $store = false) …
      › 
      › $token          = $user->createToken('SpoonJet')->accessToken;
      › $user->token    = $token;
    }

Solution

  • I found my solution, in my case it was user permissions problem on production server. If someone of you is facing same issue, you may apply this solution or in your case can be different solution.