The language I use is PHP,
Thank you very much for reading.
My requirement is to obtain the relevant data of the customer's advertising 
account through authorized ads after logging in through Oauth 2. We may 
have N customers, which is irrelevant. The problem I am currently facing is 
that I have already programmed the customer to complete the authorized 
login of Oauth 2[“ https://www.googleapis.com/auth/adwords 
https://www.googleapis.com/auth/userinfo.email 
https://www.googleapis.com/auth/userinfo.profile I only received 'access'_ 
Token "and" id_token ", but now I have checked the documents and they all 
need to obtain relevant data through a customer_id. I have read the 
official Google ads API document and it is difficult for me to evaluate 
whether this document has been helpful to me. I now need to know how to 
obtain the customer's customer_id. 

The following is my relevant code:

Oauth v2 Code .
use Google\Client;

$redirect_uri = 'http://localhost:8000/google/callback';
$httpClient = new \GuzzleHttp\Client([
'proxy' => '*.*.*.*:7890',
'verify' => false,
]);
$client = new Client();
$client->setHttpClient($httpClient);
$client->setAuthConfig(base_path() . '/keys/google_secret.json');
$client->setRedirectUri($redirect_uri);
$client->setAccessType('offline');
$client->addScope(
 [
  "https://www.googleapis.com/auth/adwords";,
  "https://www.googleapis.com/auth/userinfo.email";,
  "https://www.googleapis.com/auth/userinfo.profile";
 ]
);

if (!$request->get('code')) {
 $authUrl = $client->createAuthUrl();
 return response()->redirectTo($authUrl);
} else {
 $code = $request->get('code');
 $client->authenticate($code);
 $access_token = $client->getAccessToken();
 //....... 
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6dcc0411-1f85-4ae2-8800-1f4cbc7799a7n%40googlegroups.com.

Reply via email to