Download the PHP package onelabs/xguard-client without Composer

On this page you can find all versions of the php package onelabs/xguard-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 xguard-client

xguard-client

Laravel client SDK for x-guard — an OAuth 2.0 / OpenID Connect Identity Provider.

Drop in a Socialite provider, default routes, and a Blade login button. Get SSO into your Laravel app in 5 minutes.


What it does


Requirements


Installation

1. Install the package

2. Add credentials to .env

The XGUARD_REDIRECT_URI value must exactly match a Redirect URI registered for your App in the x-guard Developer Portal — including scheme, host, port, and path.

3. Add to config/services.php

4. Publish the migration & run it

The package adds an sso_user_id column to your users table (used to link local users to x-guard).

The migration is idempotent: it skips if the column already exists.

5. Add the login button to your login view

That's it. The button points to the default /auth/xguard/redirect route, which handles the entire OAuth flow.


Customization

Publish the config (optional)

This creates config/xguard.php where you can change defaults: scopes, route prefix, redirect-after-login, lookup column, button text, etc.

Customize the button label/style

Publish the button view (full markup control)

Custom user resolver

Need different linking logic (multi-table user storage, role assignment, domain whitelist)?

Implement the UserResolver contract:

Bind it in AppServiceProvider::register():

Disable default routes (write your own)

Set XGUARD_USE_DEFAULT_ROUTES=false (or in published config: 'use_default_routes' => false), then write your own controller using the Socialite driver:

Custom scopes per request

Available scopes: openid (required), profile, email, phone, offline_access (triggers refresh token).


Getting credentials from x-guard

You need 4 values from your x-guard developer:

Value Where it comes from
XGUARD_ISSUER The x-guard server URL (e.g. https://x-guard.example.com)
XGUARD_CLIENT_ID Developer Portal → your App → Overview tab
XGUARD_CLIENT_SECRET Developer Portal → your App → Credentials → Generate New Secret (shown ONCE)
XGUARD_REDIRECT_URI Developer Portal → your App → Redirect URIs → add the exact callback URL of this Laravel app

If you're the x-guard developer, log in to x-guard and follow the Developer Portal flow.


How it works (under the hood)

  1. User clicks <x-xguard-login-button /> → goes to /auth/xguard/redirect
  2. XGuardLoginController::redirect() calls Socialite::driver('xguard')->redirect()
  3. User is sent to {XGUARD_ISSUER}/oauth/authorize → logs in at x-guard → grants consent
  4. x-guard redirects back to {XGUARD_REDIRECT_URI}?code=...&state=...
  5. XGuardLoginController::callback():
    • Exchanges code for tokens at {XGUARD_ISSUER}/oauth/token
    • Fetches user profile from {XGUARD_ISSUER}/oauth/userinfo
    • Calls UserResolver::resolve($ssoUser) to find/create the local user
    • Auth::login() and redirects to the intended URL (or redirect_after_login)

PKCE, JWT signature verification (via the OIDC userinfo server-to-server fetch), state CSRF protection — all handled by Socialite + the underlying x-guard server.


Troubleshooting

Symptom Likely cause / fix
error=invalid_request, redirect_uri not registered XGUARD_REDIRECT_URI doesn't exactly match what's whitelisted in Developer Portal. Check scheme, host, port, path, trailing slash.
error=invalid_client Wrong XGUARD_CLIENT_SECRET or App is suspended in Developer Portal.
User logs in but new account is created instead of linking Check that email returned by x-guard matches your local user's email exactly. Or override UserResolver.
Button has no link (href="#") Default routes disabled but no xguard.redirect route defined. Either re-enable default routes or pass href="...".
Class "Laravel\Socialite\..." not found Socialite is a peer dep — composer require laravel/socialite once.

License

MIT — see LICENSE.


Credits


All versions of xguard-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/auth Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/view Version ^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 onelabs/xguard-client contains the following files

Loading the files please wait ...