Download the PHP package daniel-de-wit/lighthouse-sanctum without Composer
On this page you can find all versions of the php package daniel-de-wit/lighthouse-sanctum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download daniel-de-wit/lighthouse-sanctum
More information about daniel-de-wit/lighthouse-sanctum
Files in daniel-de-wit/lighthouse-sanctum
Package lighthouse-sanctum
Short Description Laravel Sanctum support for Laravel Lighthouse.
License MIT
Homepage https://github.com/daniel-de-wit/lighthouse-sanctum
Informations about the package lighthouse-sanctum
Lighthouse Sanctum
Add Laravel Sanctum support to Lighthouse
- Requirements
- Installation
- Usage
- Login
- Logout
- Register
- Email Verification
- Forgot Password
- Reset Password
- Custom Identification
Requirements
Installation
1. Install using composer:
2. Publish configuration and schema
3. Import the published schema into your main GraphQL schema (./graphql/schema.graphql
)
4. HasApiTokens
Apply the Laravel\Sanctum\HasApiTokens
trait to your Authenticatable model as described in the Laravel Sanctum documentation.
5. Configuration
This package relies on API Token Authentication, which uses stateless Bearer tokens to authenticate requests.
By default, Laravel Sanctum assumes that requests made from localhost should use the stateful Spa Authentication instead. To disable this behaviour, remove any lines within the stateful section of your sanctum configuration:
Make sure the following middleware is enabled for Lighthouse:
Configure Lighthouse to use the Sanctum guard:
Usage
- Login
- Logout
- Register
- Email Verification
- Resend Email Verification Link
- Forgot Password
- Reset Password
- Update Password
Login
Authenticate the user to receive a Bearer token.
Apply the Authorization header on subsequent calls using the token
(Using something other than email? See Custom Identification)
Logout
Revoke the current token.
Register
Successfully registering a user will immediately yield a bearer token (unless email verification is required).
:point_up: Want to disable password confirmation? Update your schema
When registering a user in combination with the MustVerifyEmail
contract you can optionally define the url for email verification.
Both __ID__
and __HASH__
will be replaced with the proper values.
When use_signed_email_verification_url
is enabled in the configuration, the placeholders __EXPIRES__
and __SIGNATURE__
will be replaced.
Email Verification
The verification_url provided at register
or resendEmailVerification
contains the id
and hash
for the mutation:
When use_signed_email_verification_url
is enabled in the configuration, the input requires two additional fields.
Resend Email Verification Link
Use default Laravel email verification notification.
Or use the custom verification flow by uncommenting the verification_url
argument within the ResendEmailVerificationInput
:
Example mutation:
Forgot Password
Sends a reset password notification.
Optionally use custom reset url using both __EMAIL__
and __TOKEN__
placeholders.
Reset Password
Reset the user's password.
:point_up: Want to disable password confirmation? Update your schema
Update Password
Updates the current user's password.
Custom Identification
You can customize which fields are used for authenticating users.
For example, using username
instead of the default email
.
Update the GraphQL schema accordingly
Docker
Develop locally using Docker & Docker Compose.
Setup
This will build the Docker image and prepare the container.
- CLI:
make app
- Destroy:
make destroy
CLI
Enter the container with shell to start developing.
Destroy
Shutdown and remove the container.
Testing
Coverage
Static Analysis
Contributing
Please see CONTRIBUTING for details.
Credits
- Daniel de Wit
- wimski
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of lighthouse-sanctum with dependencies
illuminate/auth Version ^9 || ^10 || ^11
illuminate/contracts Version ^9 || ^10 || ^11
illuminate/database Version ^9 || ^10 || ^11
illuminate/routing Version ^9 || ^10 || ^11
illuminate/support Version ^9 || ^10 || ^11
laravel/sanctum Version ^3.0 || ^4.0
nuwave/lighthouse Version ^6.0