This is a Laravel 12 demo project showcasing how to integrate OAuth2 with Infusionsoft (Keap) using Guzzle HTTP client and Laravel, without relying on the official SDK. It covers the entire authentication flow, access token storage, refreshing, and consuming the API (fetching contacts) with a clean Laravel service structure.
- ✅ OAuth2 Authorization Flow with Infusionsoft
- ✅ Token storage in database (access + refresh tokens)
- ✅ Automatic token refresh if expired
- ✅ Display real-time contacts from Infusionsoft on a Blade view
- ✅ Laravel Service Class pattern used
- ✅ Modular, clean code ready for production adaptation
app/
├── Http/
│ └── Controllers/
│ └── InfusionsoftOAuth2Controller.php
├── Models/
│ └── InfusionsoftToken.php
├── Services/
│ └── InfusionsoftOAuth2.php
resources/
└── views/
└── contacts.blade.php
- Clone the Repository
git clone https://github.com/umr4ever/laravel-infusionsoft-oauth-demo.git
cd laravel-infusionsoft-oauth-demo
- Install Dependencies
composer install
cp .env.example .env
php artisan key:generate
- Set Infusionsoft Credentials in
.env
INFUSIONSOFT_CLIENT_ID=your_client_id
INFUSIONSOFT_CLIENT_SECRET=your_client_secret
INFUSIONSOFT_DEV_REDIRECT_URI=http://127.0.0.1:8000/oauth/callback
- Configure Database
Set your local DB connection in .env
, then run:
php artisan migrate
- Run the Application
php artisan serve
- Authorize App
Visit this URL to start OAuth2 flow:
http://127.0.0.1:8000/oauth/authorize
- Fetch Contacts
After authorization, access:
http://127.0.0.1:8000/contacts
👋 Mohammad Umair
Senior Laravel Developer | 15+ Years of Experience
Remote from 🇮🇳 | Seeking full-time remote roles
🔗 LinkedIn | 🔗 GitHub
This project is open-sourced under the MIT license.