feat: MNG → DEV 자동 로그인 API 구현

- login_tokens 테이블 마이그레이션 생성
- LoginToken 모델 생성 (One-Time Token 관리)
- POST /api/v1/token-login 엔드포인트 추가
- 토큰 검증 후 access_token 발급, 1회용 토큰 삭제

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-20 13:43:04 +09:00
parent 993b347fb7
commit 7bea6f2deb
4 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* MNG → DEV 자동 로그인용 One-Time Token 테이블
*/
public function up(): void
{
Schema::create('login_tokens', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->comment('사용자 ID');
$table->string('token', 64)->unique()->comment('One-Time Token (64자)');
$table->timestamp('expires_at')->comment('만료 시간');
$table->timestamps();
// 인덱스
$table->index('token');
$table->index('expires_at');
// 외래키 (users 테이블과 연결)
$table->foreign('user_id')
->references('id')
->on('users')
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('login_tokens');
}
};