Download the PHP package lukapeharda/cookie-guard without Composer
On this page you can find all versions of the php package lukapeharda/cookie-guard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lukapeharda/cookie-guard
More information about lukapeharda/cookie-guard
Files in lukapeharda/cookie-guard
Package cookie-guard
Short Description Provides authorization from cookie token.
License MIT
Informations about the package cookie-guard
Cookie Guard
Introduction
Cookie Guard is a Laravel API authentication package using cookie tokens. Most of its inner workings are taken from Laravel Passport package. It is meant to be used to consume your own API with JavaScript.
Installation
Require this package, with Composer, in the root directory of your project.
Add the service provider to config/app.php
in the providers
array.
Add the LukaPeharda\CookieGuard\HasApiTokens
trait to your App\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:
Add the CreateFreshApiToken
middleware to your web
middleware group:
Usage
This middleware will attach a laravel_token
cookie to your outgoing responses.
Finally, in your config/auth.php
configuration file, you should set the driver
option of the api
authentication guard to cookie
. This will instruct your application to use CookieGuards's CookieGuard
when authenticating incoming API requests:
This middleware will attach a laravel_token cookie to your outgoing responses. This cookie contains an encrypted JWT that CookieGuard will use to authenticate API requests from your JavaScript application.
When using this method of authentication, you will need to send the CSRF token with every request via the X-CSRF-TOKEN header. Laravel will automatically send this header if you are using the default Vue configuration that is included with the framework:
License
Cookie Guard is open-sourced software licensed under the MIT license
All versions of cookie-guard with dependencies
firebase/php-jwt Version ~5.0
illuminate/auth Version ^6.0|^7.0
illuminate/container Version ^6.0|^7.0
illuminate/contracts Version ^6.0|^7.0
illuminate/database Version ^6.0|^7.0
illuminate/encryption Version ^6.0|^7.0
illuminate/http Version ^6.0|^7.0
illuminate/support Version ^6.0|^7.0