artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
684 stars 217 forks source link

"The parameter app_id is required" in Google OAuth #135

Closed sergiocastrovale closed 9 years ago

sergiocastrovale commented 9 years ago

Here's my code.

return array( 
    'storage' => 'Session', 

    'consumers' => array(
        'Google' => [
            'client_id'     => 'my-client-id-key.apps.googleusercontent.com',
            'client_secret' => 'my-client-secret',
            'scope'         => array()
        ],
    )
);

And my controller which loads things:

    public function doGoogleLogin()
    {
        $googleService = OAuth::consumer('Google');
        $code = Input::get('code');

        if (!empty($code)) {
            $api_key = 'my-api-key';
            $token = $googleService->requestAccessToken($code);

            $me = json_decode($googleService->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);

       $message = 'Your unique Google user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
...

I'm getting "The parameter app_id is required" in Google OAuth. Am I doing something wrong? I have set a "Client ID for web application" in Google, as well as a server Public API access key.

Thanks!

sergiocastrovale commented 9 years ago

I was using wrong data in my consumers array. Works fine now!