Passport keys

In Chapter 9, Adding a User Login and API Authentication with Passport, we created encryption keys for Passport with the php artisan passport:install command. These keys are stored in text files that can be found in the storage directory.

Encryption keys should not be under version control, as this would make them insecure. Instead, we need to regenerate these keys on each deploy. We can do this by adding a post-install script to our composer file.

composer.json:

"scripts": {  ...  "post-install-cmd": [
    "Illuminate\\Foundation\\ComposerScripts::postInstall",
    "php artisan optimize",
    "php artisan passport:install"
  ],}

Get Full-Stack Vue.js 2 and Laravel 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.