@@ -107,6 +107,7 @@ This section describes how to use the following features to customize the MongoD
107
107
authentication process:
108
108
109
109
- :ref:`laravel-user-auth-sanctum`
110
+ - :ref:`laravel-user-auth-passport`
110
111
- :ref:`laravel-user-auth-reminders`
111
112
112
113
.. _laravel-user-auth-sanctum:
@@ -154,6 +155,53 @@ in the Laravel Sanctum guide.
154
155
To learn more about the ``DocumentModel`` trait, see
155
156
:ref:`laravel-third-party-model` in the Eloquent Model Class guide.
156
157
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
+
157
205
.. _laravel-user-auth-reminders:
158
206
159
207
Password Reminders
0 commit comments