users-au/users-au-laravel-client

1.1 2023-12-06 10:56 UTC

This package is not auto-updated.

Last update: 2024-05-09 11:01:15 UTC


README

Latest Stable Version License Total Downloads

Introduction

This package is a Laravel client for Users.au oauth. It provides a simple way to integrate your Laravel application to log in with Users.au.

Installation

Requirements:

To get the latest version, simply run:

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

Then do vendor publish:

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

Modify user model:

$this->fillable = [
    ...
    'usersau_id',
    'usersau_access_token',
    'usersau_refresh_token',
];
$this->hidden = [
    ...
    'usersau_id',
    'usersau_access_token',
    'usersau_refresh_token',
];

Add configuration to 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'),
],

If you need to register the service provider manually. Open config/app.php and add the following to the providers array:

Usersau\UsersauLaravelClient\UsersauLaravelClientServiceProvider::class,

Run the migrations:

php artisan migrate

Configuration

Users.au Client ID and Secret

You will need to register your application with Users.au to receive a Client ID and Client Secret. You can do this at https://www.users.au.

Environment variables

You can 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://www.yourdomain.com/auth/usersau/callback"
USERSAU_HOST="https://auth.youdomain.com"

TODO

  • Add tests

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

License

The MIT License (MIT). Please see License File for more information.