Download the PHP package huseynvsal/jwt-auth-refresh without Composer

On this page you can find all versions of the php package huseynvsal/jwt-auth-refresh. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jwt-auth-refresh

JWT Auth Refresh Package

This Laravel package provides JWT authentication with access and refresh token functionality. It includes all the necessary logic for token generation, token refresh, and user logout without the need to write any complex controller or middleware.

Features

Installation

Step 1: Install the Package

Install the package using Composer.

Step 2: Publish Resources

After installing the package, you need to publish the configuration and migration files.

Run the following command to publish the resources:

This will publish:

Step 3: Run Migrations

Run the migration to create the necessary table for storing refresh tokens.

Step 4: Configure .env File

In your .env file, add the following configuration for JWT tokens:

Step 5: Set Guard in config/auth.php

Your package will automatically register the custom jwt guard for authentication. The next step is to set it in the config/auth.php file.

Ensure that your config/auth.php is configured to use the jwt guard for API authentication.

This sets the default guard for API requests to use the custom jwt guard provided by the package.

Step 6: Update User Model (Optional)

If you want to use the JWT-based authentication with your own User model, ensure that your User model implements Illuminate\Contracts\Auth\Authenticatable and have refreshTokens relation defined:

Example:

This is required so that Laravel can authenticate the user using the JWT guard.


Usage

Step 1: Login and Generate Tokens

In your AuthController, you can use the JwtAuthService to generate both the access and refresh tokens when the user logs in.

Example login method:

Step 2: Refresh Tokens

You can create an API to allow users to refresh their tokens using a valid refresh token.

Example refresh method:

Step 3: Logout and Revoke Tokens

To handle logout, you can delete the user's access and refresh tokens:


Additional Information


All versions of jwt-auth-refresh with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
firebase/php-jwt Version ^6.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/auth Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package huseynvsal/jwt-auth-refresh contains the following files

Loading the files please wait ....