Skip to content

Commit ae8eb98

Browse files
committed
DOCSP-42794: Laravel Passport
1 parent b0c3a95 commit ae8eb98

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/user-authentication.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ This section describes how to use the following features to customize the MongoD
107107
authentication process:
108108

109109
- :ref:`laravel-user-auth-sanctum`
110+
- :ref:`laravel-user-auth-passport`
110111
- :ref:`laravel-user-auth-reminders`
111112

112113
.. _laravel-user-auth-sanctum:
@@ -154,6 +155,53 @@ in the Laravel Sanctum guide.
154155
To learn more about the ``DocumentModel`` trait, see
155156
:ref:`laravel-third-party-model` in the Eloquent Model Class guide.
156157

158+
.. _laravel-user-auth-passport:
159+
160+
Laravel Passport
161+
~~~~~~~~~~~~~~~~
162+
163+
Laravel Passport is an OAuth 2.0 server implementation that offers
164+
API authentication for Laravel applications. The Laravel MongoDB Passport
165+
service provider enables Laravel Passport support for applications that
166+
use MongoDB.
167+
168+
To install Laravel MongoDB Passport, run the following command from
169+
your project root:
170+
171+
.. code-block:: bash
172+
173+
composer require designmynight/laravel-mongodb-passport
174+
175+
Next, navigate to your application's ``config/app.php`` file and
176+
add the following service provider to the ``providers`` array:
177+
178+
.. code-block:: php
179+
180+
DesignMyNight\Mongodb\MongodbPassportServiceProvider::class,
181+
182+
Then, ensure your ``User`` class extends ``DesignMyNight\Mongodb\Auth\User.php``
183+
instead of the default ``Illuminate\Foundation\Auth\User``. The following code
184+
shows how to modify your ``app\Models\User.php`` file to extend ``DesignMyNight\Mongodb\Auth\User.php``:
185+
186+
.. code-block:: php
187+
188+
<?php
189+
190+
namespace App\Models;
191+
192+
use Illuminate\Notifications\Notifiable;
193+
use DesignMyNight\Mongodb\Auth\User as Authenticatable;
194+
195+
class User extends Authenticatable
196+
{
197+
use Notifiable;
198+
...
199+
}
200+
201+
You can now use Laravel Passport in your application. For more information, see
202+
`Laravel Passport <https://laravel.com/docs/{+laravel-docs-version+}/passport>`__ in the
203+
Laravel documentation.
204+
157205
.. _laravel-user-auth-reminders:
158206

159207
Password Reminders

0 commit comments

Comments
 (0)