Download the PHP package bevi-webdev-jm/hub-auth-client without Composer

On this page you can find all versions of the php package bevi-webdev-jm/hub-auth-client. 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 hub-auth-client

Hub Auth Client

A Laravel package that provides Single Sign-On (SSO) integration for Laravel applications via OAuth2, connecting them to a centralized Hub authentication server.

Overview

This package handles the complete OAuth2 flow between your Laravel application and the Hub, including user synchronization, account linking by email, and automatic user provisioning on first login.

Requirements

Installation

The package auto-registers its service provider via Laravel's package discovery.

Setup

1. Publish the configuration

2. Add environment variables

3. Add hub_user_id to your users table

4. Add hub_user_id to your User model's $fillable array

5. Add a login link to your template

Configuration

All options are in config/hub-auth.php:

Key ENV Variable Default Description
hub_url HUB_URL http://localhost:8000 Base URL of the Hub server
client_id HUB_CLIENT_ID OAuth2 client ID issued by Hub
client_secret HUB_CLIENT_SECRET OAuth2 client secret issued by Hub
redirect HUB_REDIRECT_URI Full callback URL of your application
default_role HUB_DEFAULT_ROLE default_user Role assigned to new users (requires Spatie Permission)
redirect_after_login /home Where to redirect after successful login

Authentication Flow

  1. User visits /login/hub → redirected to Hub's OAuth2 authorization page
  2. User authenticates at Hub
  3. Hub redirects back to /login/hub/callback with an authorization code
  4. Package exchanges the code for a token and fetches the user from Hub's /api/me
  5. Local user is resolved (created, linked, or retrieved — see below)
  6. User is logged into the Laravel session and redirected to redirect_after_login

User Resolution

The DefaultHubUserResolver handles three scenarios on every login:

Username generation

If your User model has username in its $fillable array, a username is derived from the email prefix and made unique by appending a counter on collision (e.g., alice, alice1, alice2).

Role assignment

If Spatie Laravel-Permission is installed and the User model uses the HasRoles trait, new users are assigned the HUB_DEFAULT_ROLE on creation. The role must exist in the database. Role assignment is skipped (with a debug log) if the package or role is not found.

Registered Routes

Method URI Name Action
GET /login/hub hub.login Redirect to Hub OAuth
GET /login/hub/callback hub.callback Handle Hub callback

Custom User Resolution

To override how Hub users are resolved to local users, bind your own implementation of ResolvesHubUser in a service provider:

Your class must implement:

Running Tests

License

MIT


All versions of hub-auth-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.0|^9.0|^10.0|^11.0|^12.0
laravel/socialite Version ^5.0
guzzlehttp/guzzle Version ^7.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 bevi-webdev-jm/hub-auth-client contains the following files

Loading the files please wait ...