feat: Implement refresh token system for client authentication, including token creation, rotation, and revocation.

This commit is contained in:
pbao9
2026-03-16 10:23:11 +07:00
parent 44f4f64b37
commit c2e90696b6
4 changed files with 232 additions and 41 deletions
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('refresh_tokens', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('customer_id');
$table->string('token', 64)->unique(); // sha256 hex hash
$table->timestamp('expires_at');
$table->timestamps();
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
$table->index('customer_id');
});
}
public function down(): void
{
Schema::dropIfExists('refresh_tokens');
}
};