// Factory
public function definition(): array
{
$stateParameters = [
'random_string' => bin2hex(random_bytes(16)),
'session_id' => 'user_session_12345',
'csrf_token' => bin2hex(random_bytes(32)),
];
return [
'client_id' => $this->faker->word(),
'client_secret' => Crypt::encrypt('example-client-secret-' . Str::random(10)),
'authorization_endpoint' => 'https://example.com/oauth/authorize',
'token_endpoint' => 'https://example.com/oauth/token',
'redirect_uris' => [
['uri' => 'http://localhost:8000/callback'],
['uri' => 'http://localhost:8000/callback'],
],
'scopes' => [
['scope' => 'read'],
['scope' => 'write'],
],
'grant_types' => [
['grant_type' => 'authorization_code'],
['grant_type' => 'implicit'],
['grant_type' => 'client_credentials'],
['grant_type' => 'refresh_token'],
],
'state_parameter' => $this->faker->randomElement($stateParameters),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'user_id' => User::factory(),
];
}