fix: add /me API call in Facebook OAuth callbacks to trigger public_profile for Meta app review

This commit is contained in:
Paulo Castellano 2026-04-03 21:21:53 -03:00
parent c5c36a8aba
commit 0e930d7bb2
2 changed files with 13 additions and 0 deletions

View file

@ -94,6 +94,13 @@ public function callback(Request $request): View|RedirectResponse
try {
$socialUser = Socialite::driver($this->driver)->usingGraphVersion('v25.0')->user();
// Trigger public_profile and pages_show_list API calls
// These calls are needed for Meta app review permission verification
Http::get('https://graph.facebook.com/v25.0/me', [
'fields' => 'id,name',
'access_token' => $socialUser->token,
]);
// Fetch pages the user manages
$pages = $this->fetchPages($socialUser->token);

View file

@ -88,6 +88,12 @@ public function callback(Request $request): View|RedirectResponse
->redirectUrl(route('app.social.instagram-facebook.callback'))
->user();
// Trigger public_profile API call for Meta app review verification
Http::get('https://graph.facebook.com/v20.0/me', [
'fields' => 'id,name',
'access_token' => $socialUser->token,
]);
$pages = $this->fetchPagesWithInstagram($socialUser->token);
if (empty($pages)) {