Viewed   95 times

I am new to Laravel however and I am following the tutorial on, to login a user through Facebook into my application. However, almost everywhere I find a tutorial using either Github or Twitter for the Socialite Plugin provided in Laravel.

My problem is that on following everything in the tutorial, as I click on the "Login to Facebook" button, it throws an "Invalid Argument Exception" with No Socialite driver was specified.".

Another question seemed to narrow things down: https://.com/questions/29673898/laravel-socialite-invalidargumentexception-in-socialitemanager-php-line-138-n

Stating that the problem is in the config/services.php

Now, i have the app_id and app_secret. However, the redirect link seems to be confusing as I can't find it on Facebook either. I am aware that this is where my app should go to Facebook for login, however, unsure of what it should be.

Does anyone have any idea on this.



In your composer.json add- "laravel/socialite": "~2.0",

"require": {
        "laravel/framework": "5.0.*",
        "laravel/socialite": "~2.0",

the run composer update

In config/services.php add:

    'facebook' => [
        'client_id'     => '1234567890444',
        'client_secret' => '1aa2af333336fffvvvffffvff',
        'redirect'      => '',

You need to create two routes, mine are like these:

//Social Login
    'uses' => 'AuthController@getSocialAuth',
    'as'   => 'auth.getSocialAuth'

    'uses' => 'AuthController@getSocialAuthCallback',
    'as'   => 'auth.getSocialAuthCallback'

You also need to create controller for the routes above like so:

<?php namespace AppHttpControllers;

 use LaravelSocialiteContractsFactory as Socialite;

 class AuthController extends Controller

       public function __construct(Socialite $socialite){
           $this->socialite = $socialite;

       public function getSocialAuth($provider=null)
           if(!config("services.$provider")) abort('404'); //just to handle providers that doesn't exist

           return $this->socialite->with($provider)->redirect();

       public function getSocialAuthCallback($provider=null)
          if($user = $this->socialite->with($provider)->user()){
             return 'something went wrong';


and finally add Site URL to your Facebook App like so:

Saturday, August 13, 2022

Looks like there is only one nice way to achieve this:

Although /me/groups requires user_groups permission to retrieve groups the user is a member of, it can return groups created by the app without it (given there is a valid access token of course).

So - while it's clearly not as nice and seamless as I wanted it to be - my solution was to create a new Facebook group using the app (requires only a POST request) and move current members to this new one.

Edit: moving members is not a possibility, joining an app group is only possible programatically using the SDK. Therefore, when a user is not a member of this group, I'll prompt them to join. It means that everybody can join and I have to manually ban those I don't like instead of manually allowing those I want to, but given the low publicity, I can deal with this.

Thursday, December 22, 2022

This usually happens if you have entered the wrong details when you created the App in Facebook. Or have you changed a URL's of an existing App?

Can you please recheck the settings of your APP in this page?

  1. Select the correct App and click in the edit button;

  2. Check the URLs & paths are correctly entered and are pointing to the site where you have installed Ultimate Facebook plugin.

Wednesday, October 26, 2022

Just create LoginManager instance inside ObservableObject and then customise login completion. You can easily use inside SwiftUI View. No need UIViewControllerRepresentable. Here is my sample.

struct ContentView: View {
    @ObservedObject var fbmanager = UserLoginManager()
    var body: some View {
        Button(action: {
        }) {
            Text("Continue with Facebook")

class UserLoginManager: ObservableObject {
    let loginManager = LoginManager()
    func facebookLogin() {
        loginManager.logIn(permissions: [.publicProfile, .email], viewController: nil) { loginResult in
            switch loginResult {
            case .failed(let error):
            case .cancelled:
                print("User cancelled login.")
            case .success(let grantedPermissions, let declinedPermissions, let accessToken):
                print("Logged in! (grantedPermissions) (declinedPermissions) (accessToken)")
                GraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name"]).start(completionHandler: { (connection, result, error) -> Void in
                    if (error == nil){
                        let fbDetails = result as! NSDictionary
Sunday, September 18, 2022

No you cannot do this. Facebook prevents this sort of behavior to prevent spamming on peoples walls from fake accounts. You will always have to go through the initial login procedure AT LEAST ONCE.

However, if you get an offline access token for someone then you could continue to make posts from them when they are not logged in. Keep in mind that Facebook limits you to 600 posts per minute.

Friday, November 25, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :