Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define a specific scope #1

Open
DeeDeeS opened this issue May 27, 2014 · 3 comments
Open

How to define a specific scope #1

DeeDeeS opened this issue May 27, 2014 · 3 comments

Comments

@DeeDeeS
Copy link

DeeDeeS commented May 27, 2014

Hi,

i'm recently installed your bundle solution for google api client.
I have follow your differents configurations explanation :

  • Step 1: Using Composer
  • Step 2: Register the bundle
  • Step 3: Configure the bundle

but i don't understand how to specify the scope for Google Analytics Service

my code on Symfony 2.4.5 bundle :

$request = $this->getRequest();
$session = $request->getSession();

    $client = $this->get('happyr.google.api.client');
    $service = $this->get('happyr.google.api.analytics');

    if ($request->query->has('code')) {           
        $client->authenticate($request->query->get('code'));
        $session->set('token', $client->getAccessToken());
    }

    if ($session->has('token')) {
        $client->setAccessToken($session->get('token'));
    }

    if ($client->getAccessToken()) {           
        $session->set('token', $client->getAccessToken());

    } else {
        return $this->redirect($client->createAuthUrl());  
    }            
}
@DeeDeeS DeeDeeS closed this as completed Jun 20, 2014
@Nyholm Nyholm reopened this Jun 20, 2014
@Nyholm
Copy link
Member

Nyholm commented Jun 20, 2014

I will improve the documentation for this bundle.

@AlexanderMatveev
Copy link

@Nyholm looks like it's not possible, because \Google_Client is protected

/**
* @var \Google_Client client
*/
protected $client;

@Nyholm
Copy link
Member

Nyholm commented Sep 14, 2015

One could extend the HappyR\Google\ApiBundle\Services\GoogleClient to access the \Google_Client.
I see your point that it should be possible to do this without extending the HappyR\Google\ApiBundle\Services\GoogleClient. A PR on this is much welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants