Hello Shwetha,

Thank you for your reply.

I successfully authenticate the request and get users email/name etc. but 
not get "Customer Id". This is the user's data as response which I got:

Array
(
    [id] => **************
    [email] => *****@gmail.com
    [verified_email] => 1
    [name] => Sachin Kumar
    [given_name] => Sachin
    [family_name] => Kumar
    [link] => https://plus.google.com/**************
    [picture] => 
https://lh4.googleusercontent.com/-CxjPiLZwnPM/AAAAAAAAAAI/AAAAAAAAALI/QMgIXPAnqng/photo.jpg
    [gender] => male
    [locale] => en
)


Here is the code to get this response:

<?php
    
    session_start();
    
    global $objGoogleClient;
    global $objGoogleOauth;
    
    require 'login-with-google/config.php';
    
    $objGoogleClient = $gClient;
    
    if(! isset($_REQUEST['code'])){
        header('Location: ' . $objGoogleClient->createAuthUrl());
    }
    if (isset($_REQUEST['code'])) {
        $objGoogleClient->authenticate();
        $accessToken = $objGoogleClient->getAccessToken();
        $_SESSION['token'] = $accessToken;
        $_SESSION['googlePlusToken'] = $accessToken;
    }

    if (isset($_SESSION['token'])) {
        $objGoogleClient->setAccessToken($_SESSION['token']);
    }

    if ($objGoogleClient->getAccessToken()) {
        
        $gpUserData = $google_oauthV2->userinfo->get();
        echo '<pre>';
        print_r($gpUserData);
        die('huuu');
    }



Can you plz provide some piece of code or suggestion?


Regards,
Sachin


On Friday, February 3, 2017 at 9:30:26 PM UTC+5:30, Shwetha Vastrad 
(AdWords API Team) wrote:
>
> Hi Sachin,
>
> To retrieve the CustomerId using the account's username and password, you 
> need to follow these steps:
>
>    1. Generate client ID and client secret by following the instructions 
>    provided here 
>    
> <https://developers.google.com/adwords/api/docs/guides/authentication#create_a_client_id_and_client_secret>.
>  
>    Once you have the OAuth2 credentials, you need to generate the refresh 
>    token using any of the client libraries 
>    
> <https://developers.google.com/adwords/api/docs/guides/authentication#configure_and_use_a_client_library>
>    . 
>    2. Use CustomerService.getCustomers() 
>    
> <https://developers.google.com/adwords/api/docs/reference/v201609/CustomerService#getcustomers>
>  method 
>    without setting the clientCustomerId 
>    
> <https://developers.google.com/adwords/api/docs/guides/call-structure#request_headers>
>  header 
>    along with the credentials generated. The response will contain the 
> details 
>    of the authenticated account. 
>
> Regards,
> Shwetha, AdWords API Team.
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/31d33b01-6511-4f70-b48a-03e93858cc03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • How to get Cust... Sachin Kumar
    • Re: How to... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum
      • Re: Ho... Sachin Kumar
        • Re... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum

Reply via email to