Download the PHP package macsidigital/laravel-oauth2-client without Composer
On this page you can find all versions of the php package macsidigital/laravel-oauth2-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macsidigital/laravel-oauth2-client
More information about macsidigital/laravel-oauth2-client
Files in macsidigital/laravel-oauth2-client
Package laravel-oauth2-client
Short Description Laravel OAuth2 Client
License MIT
Homepage https://github.com/macsidigital/laravel-oauth2-client
Informations about the package laravel-oauth2-client
Laravel OAuth2 Client
Laravel package for OAuth 2 Client Authentication
A little OAuth2 Client Authentication Library
Support us
We invest a lot in creating open source packages, and would be grateful for a sponsor if you make money from your product that uses them.
Installation
You can install the package via composer:
Package helper
The package helper can be used to return the package version
Usage
The main aim of this library is to handle the authentication requirements of OAuth2. Then you should have a token which you can use in an API client.
There are Token Drivers for both File and Database.
File
The file driver will save a file in storage/app/oauth2, which will keep the token details required to communicate with the OAuth2 Server.
Database
Config
If you want to use the DB driver and would like to customise teh table name then you can publish the config file and amend the table_name column
Migrations
If using DB driver you will need to publish migrations.
Then you will need to run migrations
Integration Configuration
The majority of the setup can be found in the config file, which needs to be copied and placed in the laravel config directory
(Todo: Create a command to automatically publish the config file)
As the primary focus of the library is in packages, this needs to be loaded into laravel with an integration name through a service provider. So for xero:-
You also need to check the credential requirements for the oauth2 server and add to config as required.
Authorising & the AuthorisationProcessor
There are routes pre-defined to connect to the Oauth2 server, the named routes are 'oauth2.authorise' & 'oauth2.callback' and both need passing in the integration. So for xero:-
If you are using a simple straight forward Server and if all setup is done correctly we should be linking the account in no time.
However, some API's will have custom processing requirements, for example Xero needs a tenant id.
In these cases we need to create a custom AuthorisationProcessor, which is passed the League/Oauth2-client AccessToken and the integration name so that the config can be pulled.
So this is how it would look for Xero:-
Now our access token etc are saved we should be able to use the macsidigital/laravel-api-client to communicate with OAuth2 API's, of course each API will be different so you need to check documentation. Here is an example of how we would use the stored details to communicate with Xero API.
Testing
ToDo
- Tests
- Some proper documentation
Basically we are just defining how we can authorise and communicate with the API. For more details on what this means check the documentation for laravel-api-client.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Colin Hall
- MacsiDigital
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-oauth2-client with dependencies
nesbot/carbon Version ^1.26.3 || ^2.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.0
league/oauth2-client Version ^2.0