PHPackages                             digram/bukua-auth - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. digram/bukua-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

digram/bukua-auth
=================

Login with Bukua OAuth for your Laravel application

v2.1.20(7mo ago)183Apache-2.0PHPPHP ^5.6||^7.0||^8.0

Since May 9Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/digram/bukua-auth)[ Packagist](https://packagist.org/packages/digram/bukua-auth)[ Docs](https://www.bukuaplatform.com)[ RSS](/packages/digram-bukua-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (26)Used By (0)

Login with Bukua Laravel Integration
====================================

[](#login-with-bukua-laravel-integration)

This package provides seamless **OAuth 2.0 authentication** with Bukua for Laravel applications, handling the complete authentication flow and user management.

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

[](#table-of-contents)

- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
    - [Environment Variables](#environment-variables)
    - [Database Setup](#database-setup)
    - [User Model Configuration](#user-model-configuration)
    - [CORS Configuration](#cors-configuration)
- [Usage](#usage)
    - [Login Button Implementation](#login-button-implementation)
    - [Authentication Routes](#authentication-routes)
- [Events](#events)
- [API Methods](#api-methods)
- [Troubleshooting](#troubleshooting)
- [Support](#support)

Prerequisites
-------------

[](#prerequisites)

Before using this package, ensure you have:

1. **Bukua Developer Account**

    - Register as an app developer at [Bukua Platform - Development Environment](https://bukua-core.apptempest.com/login) or [Bukua Platform - Production Environment](https://app.bukuaplatform.com/login)
    - Create a **User Access App** in the selected environment above
2. **Application Credentials**

    - Obtain your `client_id`, `client_secret` and `app_url` from the Bukua Developer Dashboard
3. **Laravel Application**

    - Laravel 8.x or higher
    - Composer for dependency management

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

[](#installation)

1. **Install the package via Composer:**

    ```
    composer require digram/bukua-auth
    ```
2. **Clear configuration cache:**

    ```
    # For development
    php artisan config:clear && php artisan route:clear

    # For production
    php artisan config:cache && php artisan route:cache
    ```

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

[](#configuration)

### Environment Variables

[](#environment-variables)

Add the following variables to your `.env` file:

```
# Bukua OAuth Configuration
BUKUA_USER_ACCESS_CLIENT_ID=your-client-id-here
BUKUA_USER_ACCESS_CLIENT_SECRET=your-client-secret-here
BUKUA_USER_ACCESS_APP_URL="https://your-app-url.com"
BUKUA_BASE_URL="https://bukua-core.apptempest.com"  # Development
# BUKUA_BASE_URL="https://app.bukuaplatform.com"    # Production

# Application Settings
BUKUA_USER_MODEL="App\\Models\\User"
BUKUA_REDIRECT_AFTER_LOGIN="/dashboard" # Your authenticated user dashboard URL
```

**Configuration Notes:**

- **Environment**: Use the development base URL for testing and production URL for live applications
- **User Access App URL**: Must exactly match the App URL from your Bukua Developer Dashboard
- **User Model**: Ensure this matches your application's User model namespace

### Database Setup

[](#database-setup)

1. **Update your User migration:**

    ```
    Schema::table('users', function ($table) {
        $table->char('bukua_user_id', 36)->nullable()->index();
        $table->text('bukua_access_token')->nullable();
        $table->text('bukua_refresh_token')->nullable();
        $table->string('name')->nullable();
        // Consider adding index for better performance
        $table->index(['bukua_user_id']);
    });
    ```
2. **Run migrations:**

    ```
    php artisan migrate
    ```

### User Model Configuration

[](#user-model-configuration)

Update your User model to include the Bukua fields:

```
