PHPackages                             users-au/users-au-laravel-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. users-au/users-au-laravel-client

Abandoned → [users-au/laravel-client](/?search=users-au%2Flaravel-client)Library

users-au/users-au-laravel-client
================================

Users.au Laravel Client

1.1.2(11mo ago)1136MITPHPPHP ^8.0CI passing

Since Sep 23Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/Users-au/laravel-client)[ Packagist](https://packagist.org/packages/users-au/users-au-laravel-client)[ Docs](https://github.com/users-au/laravel-client)[ RSS](/packages/users-au-users-au-laravel-client/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (6)Versions (5)Used By (0)

Users.au OAuth Laravel Client
=============================

[](#usersau-oauth-laravel-client)

[![Latest Stable Version](https://camo.githubusercontent.com/3e88ebcdb0db419c086b037844edc15d22354db569fd92b1924bbc14c5d31a36/68747470733a2f2f706f7365722e707567782e6f72672f75736572732d61752f6c61726176656c2d636c69656e742f762f737461626c652e737667)](https://packagist.org/packages/users-au/laravel-client)[![License](https://camo.githubusercontent.com/226edfd7448e3971bdf653c4d6167bb45b6de4806d668c6b3be2a410f314a4df/68747470733a2f2f706f7365722e707567782e6f72672f75736572732d61752f6c61726176656c2d636c69656e742f6c6963656e73652e737667)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/4a868c8217e0174e528f48c5ad9c94b72eafcc99a4b4f80864a054b824ba04eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75736572732d61752f6c61726176656c2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/users-au/laravel-client)[![Tests](https://github.com/users-au/laravel-client/workflows/Tests/badge.svg)](https://github.com/users-au/laravel-client/actions)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Migration Guide](#migration-guide)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [Changelog](#changelog)
- [License](#license)

Introduction
------------

[](#introduction)

This package provides a seamless Laravel integration for Users.au OAuth authentication. It simplifies the process of implementing Users.au single sign-on (SSO) in your Laravel applications, handling authentication, user management, and session control.

Features
--------

[](#features)

- 🔐 **OAuth 2.0 Authentication** - Secure authentication via Users.au
- 👤 **Automatic User Management** - Creates and updates user records automatically
- 🔄 **Token Management** - Handles access and refresh tokens
- 🎨 **Profile Photo Support** - Optional profile photo synchronization
- 🛡️ **Middleware Protection** - Configurable middleware for route protection
- 📱 **Account Management** - Direct integration with Users.au account pages
- 🚪 **Single Sign-Out** - Coordinated logout across systems

Requirements
------------

[](#requirements)

- [PHP](https://php.net) &gt;= 8.0
- [Composer](https://getcomposer.org) &gt;= 2.0
- Laravel 5.0+ (supports versions 5.x through 10.x)
- Users.au OAuth application credentials

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require users-au/laravel-client
```

Publish the package assets:

```
php artisan vendor:publish --provider="Usersau\UsersauLaravelClient\UsersauLaravelClientServiceProvider"
```

Run the migrations to add required columns to your users table:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

### 1. Update Your User Model

[](#1-update-your-user-model)

Add the following fields to your User model's `fillable` and `hidden` arrays:

```
// app/Models/User.php

protected $fillable = [
    // ... existing fields
    'usersau_id',
    'usersau_access_token',
    'usersau_refresh_token',
];

protected $hidden = [
    // ... existing fields
    'usersau_id',
    'usersau_access_token',
    'usersau_refresh_token',
];
```

### 2. Service Configuration

[](#2-service-configuration)

Add Users.au configuration to your `config/services.php`:

```
'usersau' => [
    'client_id' => env('USERSAU_CLIENT_ID'),
    'client_secret' => env('USERSAU_CLIENT_SECRET'),
    'redirect' => env('USERSAU_REDIRECT_URI'),
    'host' => env('USERSAU_HOST'),
],
```

### 3. Environment Variables

[](#3-environment-variables)

Set the following environment variables in your `.env` file:

```
USERSAU_CLIENT_ID="your_client_id"
USERSAU_CLIENT_SECRET="your_client_secret"
USERSAU_REDIRECT_URI="https://yourdomain.com/auth/usersau/callback"
USERSAU_HOST="https://auth.yourdomain.com"
```

### 4. Package Configuration

[](#4-package-configuration)

The package publishes a configuration file at `config/usersau.php`. You can customize:

```
return [
    'after_login_url' => '/',              // Redirect after successful login
    'after_logout_url' => '/',             // Redirect after logout
    'after_register_url' => '/',           // Redirect after registration
    'user_model' => App\Models\User::class, // Your user model
    'middleware' => ['web'],               // Middleware for auth routes
    'profile_photo_column' => null,        // Column name for profile photos (optional)
];
```

### 5. Manual Service Provider Registration (Optional)

[](#5-manual-service-provider-registration-optional)

If auto-discovery is disabled, manually register the service provider in `config/app.php`:

```
'providers' => [
    // ... other providers
    Usersau\UsersauLaravelClient\UsersauLaravelClientServiceProvider::class,
],
```

Usage
-----

[](#usage)

### Authentication Routes

[](#authentication-routes)

The package automatically registers the following routes:

RouteNameDescription`GET /auth/usersau/redirect``usersau.login`Initiates OAuth flow`GET /auth/usersau/callback`-OAuth callback handler`GET /auth/usersau/logout``usersau.logout`Logout and redirect to Users.au`GET /auth/usersau/register``usersau.register`Redirect to Users.au registration`GET /auth/usersau/account``usersau.account`Redirect to Users.au account page### Basic Usage Examples

[](#basic-usage-examples)

#### Login Link

[](#login-link)

```
// In your Blade template

    Login with Users.au

```

#### Logout Link

[](#logout-link)

```

    Logout

```

#### Registration Link

[](#registration-link)

```

    Register with Users.au

```

#### Account Management Link

[](#account-management-link)

```
@auth

    Manage Account

@endauth
```

### Middleware Protection

[](#middleware-protection)

Protect your routes using Laravel's built-in auth middleware:

```
// In your routes/web.php
Route::middleware('auth')->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index']);
    Route::get('/profile', [ProfileController::class, 'show']);
});
```

### Custom User Handling

[](#custom-user-handling)

You can listen for authentication events to perform custom actions:

```
// In a service provider
Event::listen(\Illuminate\Auth\Events\Login::class, function ($event) {
    // Custom logic after user login
    $user = $event->user;

    // Log login activity
    activity()
        ->performedOn($user)
        ->log('User logged in via Users.au');
});
```

API Reference
-------------

[](#api-reference)

### AuthController Methods

[](#authcontroller-methods)

The `AuthController` provides the following public methods:

#### `redirect()`

[](#redirect)

Initiates the OAuth flow by redirecting to Users.au.

#### `callback()`

[](#callback)

Handles the OAuth callback, creates/updates user records, and logs in the user.

**Process:**

1. Retrieves user data from Users.au
2. Creates or updates local user record
3. Syncs profile photo (if configured)
4. Logs in the user
5. Redirects to configured URL

#### `logout()`

[](#logout)

Logs out the user locally and redirects to Users.au logout.

#### `account()`

[](#account)

Redirects authenticated users to their Users.au account page.

#### `register()`

[](#register)

Redirects to Users.au registration page.

### Configuration Options

[](#configuration-options)

OptionTypeDefaultDescription`after_login_url`string`'/'`URL to redirect after login`after_logout_url`string`'/'`URL to redirect after logout`after_register_url`string`'/'`URL to redirect after registration`user_model`string`App\Models\User::class`User model class`middleware`array`['web']`Middleware for auth routes`profile_photo_column`stringnull`null`Migration Guide
---------------

[](#migration-guide)

### From Version 1.x to 2.x

[](#from-version-1x-to-2x)

If you're upgrading from an older version:

1. Update your composer requirements
2. Run `php artisan vendor:publish --provider="Usersau\UsersauLaravelClient\UsersauLaravelClientServiceProvider" --force`
3. Run `php artisan migrate`
4. Update your environment variables if needed

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

#### "Invalid State Exception"

[](#invalid-state-exception)

This usually occurs when the OAuth state parameter doesn't match. Common causes:

- Session configuration issues
- Multiple redirect attempts
- Browser security settings

**Solution:** Ensure your session driver is properly configured and cookies are enabled.

#### "Client Exception during OAuth"

[](#client-exception-during-oauth)

This indicates communication issues with Users.au servers.

**Solutions:**

- Verify your `USERSAU_CLIENT_ID` and `USERSAU_CLIENT_SECRET`
- Check your `USERSAU_REDIRECT_URI` matches exactly what's configured in Users.au
- Ensure `USERSAU_HOST` is correct

#### "User Model Not Found"

[](#user-model-not-found)

The configured user model doesn't exist.

**Solution:** Verify the `user_model` in `config/usersau.php` points to your correct User model.

#### Migration Errors

[](#migration-errors)

Issues running the package migrations.

**Solutions:**

- Ensure your users table exists before running migrations
- Check for conflicting column names
- Verify database connection

### Debug Mode

[](#debug-mode)

Enable debug mode in your `.env` for detailed error messages:

```
APP_DEBUG=true
LOG_LEVEL=debug
```

### Support

[](#support)

For additional support:

- Check the [GitHub Issues](https://github.com/users-au/laravel-client/issues)
- Review the [Users.au Documentation](https://www.users.au/docs)
- Contact support at

Contributing
------------

[](#contributing)

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

### Development Setup

[](#development-setup)

1. Clone the repository
2. Install dependencies: `composer install`
3. Run tests: `composer test`
4. Follow PSR-12 coding standards

### Testing

[](#testing)

Run the test suite:

```
composer test
```

For coverage reports:

```
vendor/bin/phpunit --coverage-html coverage
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE.md](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance58

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~188 days

Total

4

Last Release

344d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e2951851fcef464f5f5745cac87603ddd3675ba9f92623c5156a6073e499e28?d=identicon)[sicaboy](/maintainers/sicaboy)

---

Top Contributors

[![sicaboy](https://avatars.githubusercontent.com/u/2426114?v=4)](https://github.com/sicaboy "sicaboy (13 commits)")

---

Tags

oauth2-clientusers-au

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/users-au-users-au-laravel-client/health.svg)

```
[![Health](https://phpackages.com/badges/users-au-users-au-laravel-client/health.svg)](https://phpackages.com/packages/users-au-users-au-laravel-client)
```

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

58113.6k3](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
