From 36985c516321dd38fc5e7139a73d8576fe50f76f Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Wed, 6 Mar 2024 14:49:54 +0330 Subject: [PATCH 1/2] rewrite installing Laravel Passport --- passport.md | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/passport.md b/passport.md index ff5a9270e8d..f7c3d0024f6 100644 --- a/passport.md +++ b/passport.md @@ -61,24 +61,17 @@ However, if you are attempting to authenticate a single-page application, mobile ## Installation -To get started, install Passport via the Composer package manager: +You may install Laravel Passport via the `install:api` Artisan command: ```shell -composer require laravel/passport +php artisan install:api --passport ``` -Next, you should execute the `passport:install` Artisan command. This command will publish and run the database migrations necessary for creating the tables your application needs to store OAuth2 clients and access tokens: +This command will publish and run the database migrations necessary for creating the tables your application needs to store OAuth2 clients and access tokens and will create the encryption keys required to generate secure access tokens. -```shell -php artisan passport:install -``` - -Additionally, the `passport:install` command will create the encryption keys required to generate secure access tokens, as well as the "personal access" and "password grant" clients, which will be used to generate access tokens. - -> [!NOTE] -> If you would like to use UUIDs as the primary key value of the Passport `Client` model instead of auto-incrementing integers, please install Passport using [the `uuids` option](#client-uuids). +Additionally, this command will ask if you would like to use UUIDs as the primary key value of the Passport `Client` model instead of auto-incrementing integers. -After running the `passport:install` command, add the `Laravel\Passport\HasApiTokens` trait to your `App\Models\User` model. This trait will provide a few helper methods to your model which allow you to inspect the authenticated user's token and scopes. If your model is already using the `Laravel\Sanctum\HasApiTokens` trait, you may remove that trait: +After running the `install:api` command, add the `Laravel\Passport\HasApiTokens` trait to your `App\Models\User` model. This trait will provide a few helper methods to your model which allow you to inspect the authenticated user's token and scopes: -#### Client UUIDs - -You may also run the `passport:install` command with the `--uuids` option present. This option will instruct Passport that you would like to use UUIDs instead of auto-incrementing integers as the Passport `Client` model's primary key values. After running the `passport:install` command with the `--uuids` option, you will be given additional instructions regarding disabling Passport's default migrations: - -```shell -php artisan passport:install --uuids -``` - ### Deploying Passport From cb6eb1230c03724d3f6ebbdca160f434d311e592 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 7 Mar 2024 11:24:53 -0600 Subject: [PATCH 2/2] formatting --- passport.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passport.md b/passport.md index f7c3d0024f6..315d906bbbf 100644 --- a/passport.md +++ b/passport.md @@ -67,7 +67,7 @@ You may install Laravel Passport via the `install:api` Artisan command: php artisan install:api --passport ``` -This command will publish and run the database migrations necessary for creating the tables your application needs to store OAuth2 clients and access tokens and will create the encryption keys required to generate secure access tokens. +This command will publish and run the database migrations necessary for creating the tables your application needs to store OAuth2 clients and access tokens. The command will also create the encryption keys required to generate secure access tokens. Additionally, this command will ask if you would like to use UUIDs as the primary key value of the Passport `Client` model instead of auto-incrementing integers.