Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
RR feedback
  • Loading branch information
norareidy committed Aug 29, 2024
commit 0b959f889606b9bcd15c5e897fac38092f5ff422
24 changes: 17 additions & 7 deletions docs/user-authentication.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ Laravel Passport is an OAuth 2.0 server implementation that offers
API authentication for Laravel applications. Use Laravel Passport if
your application requires OAuth2 support.
Copy link
Contributor

Choose a reason for hiding this comment

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

S: maybe you can link to a resource describing Oauth and/or passport?


.. tip::

To learn more about Laravel Passport and the OAuth 2.0 protocol, see
the following resources:

- `Laravel Passport <https://laravel.com/docs/{+laravel-docs-version+}/passport>`__ in the
Laravel documentation.

- `OAuth 2.0 <https://oauth.net/2/>`__ on the OAuth website.

Install Laravel Passport
````````````````````````

Expand Down Expand Up @@ -201,14 +211,13 @@ API requests. The following example adds the ``api`` authentication guard
to the ``guards`` array:

.. code-block:: php
:emphasize-lines: 7-10
:emphasize-lines: 6-9

'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],

'api' => [
'driver' => 'passport',
'provider' => 'users',
Expand All @@ -229,8 +238,8 @@ You can define the following {+odm-short+} model classes:
- ``MongoDB\Laravel\Passport\RefreshToken``, which extends ``Laravel\Passport\RefreshToken``
- ``MongoDB\Laravel\Passport\Token``, which extends ``Laravel\Passport\Token``

For example, the following code overrides the default ``Laravel\Passport\AuthCode``
model class by defining a ``MongoDB\Laravel\Passport\AuthCode`` class and including
The following example code extends the default ``Laravel\Passport\AuthCode``
model class when defining a ``MongoDB\Laravel\Passport\AuthCode`` class and includes
the ``DocumentModel`` trait:

.. code-block:: php
Expand All @@ -243,9 +252,10 @@ the ``DocumentModel`` trait:
protected $keyType = 'string';
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Q: does the user need to create models for each of the listed classes? If so, that should be more clear in a note or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah each one needs a custom model. I changed the wording of the paragraph below (line 246) to clarify that, lmk if it's clear enough

After defining each custom model, instruct Passport to use the models in the ``boot()``
method of your application's ``App\Providers\AppServiceProvider`` class, as shown
in the following code:
After defining custom models that extend each ``Laravel\Passport`` class, instruct
Passport to use the models in the ``boot()`` method of your application's
``App\Providers\AppServiceProvider`` class. The following example adds each custom
model to the ``boot()`` method:

.. literalinclude:: /includes/auth/AppServiceProvider.php
:language: php
Expand Down
Loading