phplaravel-5.1dropbox-phplaravel-socialite

Undefined index: client_id while using Laravel 5.1 / Socialite / Dropbox SDK


So I've realized that Laravel 5.1 can't use sessions to store the CSRF token required by the Dropbox SDK when authenticating a user via OAuth2. To get around this, I've followed this great post to use this provider and Laravel Socialite to make the OAuth2 calls for me but, even after following that doc to the letter, I'm still getting the following error:

ErrorException in SocialiteManager.php line 91: Undefined index: client_id

I can't find where client_id would even be an index in the flow so I'm thoroughly confused on this one. Any help would be great appreciated.

Here are the methods that are being fired to evoke the Socialite/Dropbox service provider:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

// other Classes
use App\User;
use Hash;
use Input;
use Auth;
use DB;
use Socialize;

class UserController extends Controller
{
    public function showDropbox()
    {
        return Socialize::driver('dropbox')->redirect();
    }
}

Solution

  • It was something very simple and a complete oversight on my part... I had the wrong indices in the config/services.php file that the tutorial required.

    I had...

    'dropbox' => [
        'redirect'  => env('DROPBOX_REDIRECT_URI'),
        'key'    => env('DROPBOX_KEY'),
        'secret' => env('DROPBOX_SECRET'),
    ],
    

    ...when I should've had:

    'dropbox' => [
        'redirect'  => env('DROPBOX_REDIRECT_URI'),
        'client_id'    => env('DROPBOX_KEY'),
        'client_secret' => env('DROPBOX_SECRET'),
    ],
    

    Hope that helps someone!