laravel / socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.
https://laravel.com/docs/socialite
MIT License
5.55k stars 942 forks source link

Facebook login for business with configuration ID #716

Open ChetanTechnource opened 2 days ago

ChetanTechnource commented 2 days ago

Socialite Version

5.16

Laravel Version

11.9

PHP Version

8.3.11

Database Driver & Version

Mysql 8.0

Description

My facebook app has been upgraded to use facebook login for business. When I am trying to login, I am receiving following error :

It looks like this app isn't available
To fix this, please contact *APP NAME*.
public function redirectToFacebook(): RedirectResponse
{
        return Socialite::driver('facebook')->usingGraphVersion(config('services.facebook.version'))->redirect();
}

It would be nice to have method similar to usingGraphVersion i.e usingConfigIdForBusinessLogin(config('services.facebook.configuration_id'))

Steps To Reproduce

You should be able to reproduce if you are using facebook login for business.

github-actions[bot] commented 2 days ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

ev-gor commented 2 days ago

According to Facebook's official documentation, you need to add your configuration ID as an optional parameter. So try this and let us know the result

public function redirectToFacebook(): RedirectResponse
{
        return Socialite::driver('facebook')
        ->usingGraphVersion(config('services.facebook.version'))
        ->with(['config_id' => config('services.facebook.configuration_id')])
        ->redirect();
}