laravel / passport

Laravel Passport provides OAuth2 server support to Laravel.

Home Page:https://laravel.com/docs/passport

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel/Passport Installation Error Cause of HasApiTokens Trait

alpemreelmas opened this issue · comments

Passport Version

12

Laravel Version

11.9

PHP Version

8.2

Database Driver & Version

10.4.32-MariaDB - mariadb.org binary distribution

Description

Receiving error when you try to use User model

Installation

I've done everything according to documentation. Termınal even said to me to add traits to the user model.

image

Error receiving part

When I tried to register it threw me an error

Screenshot 2024-06-25 211009

My composer file is:

image

Documantation

In the documentation there is nothing more step to install passport. I also tried to install via
composer require laravel/passport
It says that composer requirements are not resolved.

image

Steps To Reproduce

to reproduce this issue just create a laravel application and just follow documentation of laravel/passport 11.x

The Composer error is clear: Install or enable PHP's sodium extension.

The Composer error is clear: Install or enable PHP's sodium extension.

But the thing is I installed by myself via composer require laravel/passport
So this is not in the docs

If code runs this under the hood, it doesn't throw an error

After a couple of tests, enabling the extension doesn't throw an error. But the point is information of the user so you should show a more detailed error response.

I think the issue is clear here. You need the sodium extension. Even after installing passport, sub-dependencies can require new extensions like the case here.

I think the issue is clear here. You need the sodium extension. Even after installing passport, sub-dependencies can require new extensions like the case here.

Yes because I run the command by myself documentation suggestion composer script doesn't throw an error so the part that you said error is clear, was my research it didn't thrown by the command that documentation says this is more than issue the thing that you have to make clear in the documentation I think