diff --git a/database/migrations/2025_08_03_213559_change_token_to_text_on_social_provider_users_table.php b/database/migrations/2025_08_03_213559_change_token_to_text_on_social_provider_users_table.php new file mode 100644 index 0000000..551b9f3 --- /dev/null +++ b/database/migrations/2025_08_03_213559_change_token_to_text_on_social_provider_users_table.php @@ -0,0 +1,21 @@ +text('token')->change(); + }); + } + + public function down(): void + { + Schema::table('social_provider_user', function (Blueprint $table) { + $table->string('token', 400)->change(); + }); + } +}; diff --git a/database/migrations/2025_08_03_213701_change_refresh_token_to_text_on_social_provider_users_table.php b/database/migrations/2025_08_03_213701_change_refresh_token_to_text_on_social_provider_users_table.php new file mode 100644 index 0000000..d075d08 --- /dev/null +++ b/database/migrations/2025_08_03_213701_change_refresh_token_to_text_on_social_provider_users_table.php @@ -0,0 +1,22 @@ +text('refresh_token')->change(); + }); + } + + public function down(): void + { + Schema::table('social_provider_user', function (Blueprint $table) { + $table->string('refresh_token')->change(); + }); + } +}; diff --git a/src/Http/Controllers/SocialController.php b/src/Http/Controllers/SocialController.php index 0050bf5..8be1cae 100644 --- a/src/Http/Controllers/SocialController.php +++ b/src/Http/Controllers/SocialController.php @@ -19,7 +19,9 @@ public function redirect(Request $request, string $driver): RedirectResponse { $this->dynamicallySetSocialProviderCredentials($driver); - return Socialite::driver($driver)->redirect(); + $scopes = config('devdojo.auth.providers.'.$driver.'.scopes', []); + + return Socialite::driver($driver)->scopes($scopes)->redirect(); } private function dynamicallySetSocialProviderCredentials($provider) diff --git a/src/Models/SocialProvider.php b/src/Models/SocialProvider.php index 53d9b77..4ac5f9f 100644 --- a/src/Models/SocialProvider.php +++ b/src/Models/SocialProvider.php @@ -25,6 +25,11 @@ public function getRows() foreach ($socialProviders as $key => $provider) { $provider['slug'] = $key; + + if (isset($provider['scopes']) && is_array($provider['scopes'])) { + $provider['scopes'] = implode(',', $provider['scopes']); + } + array_push($rowsArray, $provider); }