Download the PHP package weldist/laravel-passport-client-scopes without Composer

On this page you can find all versions of the php package weldist/laravel-passport-client-scopes. 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 laravel-passport-client-scopes

weldist/laravel-passport-client-scopes

Tests PHP Laravel Passport

Per-client default scopes and standard insufficient_scope responses for Laravel Passport client credentials tokens. Grant a service its scopes once, on the server, and stop maintaining the same list in every client's .env.

A weld.ist project.

Unofficial. Not affiliated with Laravel.

The Problem

Passport lets you restrict what a client may receive through the oauth_clients.scopes column, but that list is only a ceiling. A client credentials token carries exactly the scopes the client asks for:

So every machine client has to keep a copy of its own permission list and send it on each token request. Every time the server grants a new scope, each client needs a config change and a redeploy. Asking for * doesn't help either: once the client's scopes column is set, * is not in it and gets filtered out.

Passport's token response doesn't include the scope field either, so a client can't tell which scopes it was actually issued.

When a scope is missing, Passport answers with a generic 403. A client cannot tell it apart from any other authorization failure, so it cannot react, for example by fetching a fresh token. A missing or invalid token gets a 401 without the WWW-Authenticate header that RFC 6750 §3 requires.

A client whose scopes column is null is not restricted at all: it receives any scope it asks for.

The Solution

This package welds the missing pieces onto Passport:

A client that does send scope still gets the narrower token it asked for. Other grant types are unaffected.

Requirements

Installation

The service provider is auto-discovered — no manual registration.

Setup

Passport's default oauth_clients migration has no scopes column. If your table doesn't have one yet, publish and run this package's migration:

Then grant scopes to a client:

The client now requests a token without any scope and receives both.

[!WARNING] Clients that existed before you installed the package have a null scopes column and receive no scopes from now on. Fill the column of every client credentials client before you deploy.

Configuration

Publish the config file to change the defaults:

Key Default Effect
allow_unconfigured_clients false true restores Passport's behavior for a null column: the client receives any scope it requests.
authentication_challenge true false leaves 401 responses without the WWW-Authenticate header.

How It Works

oauth_clients.scopes Token request without scope Token request with scope
null no scopes no scopes (any requested scope with allow_unconfigured_clients)
[] no scopes no scopes
["a", "b"] a b requested scopes that are in the list

Minimal override

CI runs PHP 8.4–8.5 via .github/workflows/tests.yml.

License

This package is open-sourced software licensed under the MIT license.


All versions of laravel-passport-client-scopes with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/passport Version ^13.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 weldist/laravel-passport-client-scopes contains the following files

Loading the files please wait ...