laravel / passport

Laravel Passport provides OAuth2 server support to Laravel.
https://laravel.com/docs/passport
MIT License
3.29k stars 780 forks source link

Laravel Passport has error with Carbon. #1728

Closed kindslayer closed 8 months ago

kindslayer commented 8 months ago

Laravel Version

11.0

PHP Version

8.2.16-fpm

Database Driver & Version

postgres:15.6-alpine

Description

This error happens when I use Passport's "Consuming Your API With JavaScript" feature and activate the middleware CreateFreshApiToken::class.

Error message: Carbon\Carbon::rawAddUnit(): Argument laravel/framework#3 ($value) must be of type int|float, string given, called in /var/www/vendor/nesbot/carbon/src/Carbon/Traits/Units.php on line 324

Error details: link to error details

I want to create an issue for this on GitHub.

Steps To Reproduce

  1. Install Passport: composer require laravel/passport

  2. Run Passport migrations: php artisan migrate

  3. Modify passport config in AppServiceProvider

          Passport::cookie('SPA-TOKEN');
          Passport::hashClientSecrets();
  4. Use Passport's CreateFreshApiToken middleware in web middleware group.

  5. Make new route in web.php and put this on it.

      Auth::loginUsingId(1)

    In next refresh application has crash

driesvints commented 8 months ago

Seems like a PR was sent in so let's see how it goes. Thanks