Hello Joven,

>From your request I am seeing that you have not included the scope to get 
email.

https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&;
*scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords*
&response_type=code&redirect_uri=http%3A%2F%2Fdev.xxxxxxxxxxx.com%2Faccount%2Fmyapi&client_id=254682842771-e0pgjq248s5doj059e3qo87a91l4m4gc.apps.googleusercontent.com&from_login=1&as=2ff3f2831fd61830&authuser=0

So Your request should be like this

https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&;
*scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email*
&response_type=code&redirect_uri=http%3A%2F%2Fdev.xxxxxxxxxxx.com%2Faccount%2Fmyapi&client_id=254682842771-e0pgjq248s5doj059e3qo87a91l4m4gc.apps.googleusercontent.com&from_login=1&as=2ff3f2831fd61830&authuser=0

After user select his account, it will redirected to the set redirection 
URL together with "code" parameter  <-- (So here I'm expecting to receive 
the email address too? Is that correct)
--> No, You cannot get email address directly. You need to make curl 
request to get email address.

You need to call curl request after getting Refresh Token / Access Token.
Curl Url should be like this
$curl_url = 
"https://www.googleapis.com/oauth2/v2/userinfo?access_token="YOUR_ACCESS_TOKEN 
";

Under the curl response you can get email for authorize user.

Hope this helps.






On Thursday, 14 July 2016 19:56:53 UTC+5:30, Joven Albarida wrote:
>
> Thanks Chirag, will study what you mean on this... I only tried to set 
> this scope under AdWords API but doesn't return the Email 
>
> This my following steps in-case there something wrong on what im doing :)
>
> + On background I set all required credential to Access AdWords API, then 
> I also set the "scopes" 
> + After all that I redirect the user to Auth URL for the application get 
> the access token, refresh token etc.
> Format of the request:
>
> https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords&response_type=code&redirect_uri=http%3A%2F%2Fdev.xxxxxxxxxxx.com%2Faccount%2Fmyapi&client_id=254682842771-e0pgjq248s5doj059e3qo87a91l4m4gc.apps.googleusercontent.com&from_login=1&as=2ff3f2831fd61830&authuser=0
>
> + After user select his account, it will redirected to the set redirection 
> URL together with "code" parameter  <-- (So here I'm expecting to receive 
> the email address too? Is that correct)
>
> + After the application received the code, I will use that to get the 
> "Access token, Refresh token" which is working fine. Then I will saved this 
> token to my storage for later use
>
> + On my application I also need to save the choosed Email (So this is my 
> main problem im stuck with, so that I post my question on this forum :)
>
>
> Again appriciate your help in advance, thanks guys 
>
>
>
> On Thursday, July 14, 2016 at 1:19:04 PM UTC+8, Chirag wrote:
>>
>> Hello Joven,
>>
>> Yes, Zweitze is right.
>>
>> When you get refresh token to get access of Adwords API, you also need to 
>> include scope to get User Email along with Adwords API scope.
>> To get user email you can use Google OAuth2 API v2 scope.
>>
>> Scope to be used to get User email : 
>> https://www.googleapis.com/auth/userinfo.email
>>
>>
>> Thanks,
>>
>> On Wednesday, 13 July 2016 17:48:28 UTC+5:30, Zweitze wrote:
>>>
>>> This is certainly possible but I don't have an exact answer.
>>> When you request access from the user, you supply which API you want 
>>> access to - AdWords API in this case. After a user logs in, he sees a page 
>>> asking to give access to his AdWords information.
>>> Actually you can ask for access to multiple APIs at the same time. Say 
>>> you want access to AdWords and Analytics, the user logs in and then see a 
>>> page asking for permission to access both AdWords and Analytics. When the 
>>> user grants this access, you can use the same access token for both AdWords 
>>> and Analytics.
>>>
>>> Well: Another API has minimal email access, if you include that, you can 
>>> use that API (and the returned access token) to ask for the email address. 
>>> Unfortunately I don't have the name of the grant at hand. But I also don't 
>>> program PHP so I can't help you any further.
>>>
>>> Still, this is the direction to go. I hope it makes sense.
>>>
>>>
>>>
>>> On Friday, July 1, 2016 at 9:37:09 PM UTC+2, Joven Albarida wrote:
>>>>
>>>> Hi Adwords Team,
>>>>
>>>> I'm trying to get the Email address using Google_Client Library on PHP
>>>>
>>>> But the access token was created from AdWords API? Is this kind of 
>>>> possible?
>>>>
>>>> If Yes, may I request if you can direct me to the references.  If No, 
>>>> is there another way to do this by getting the Email address?
>>>>
>>>> Thank you.,
>>>>
>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/f8cf5a49-df91-4451-9a4a-3740f61a1d27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to