Hi Anash,

Thank you for help.
In my opinion, that oauth is already acting. I get CustomerId. I would like 
to get the e-mail address of the user, but my code isn't work.
My code:

 CustomerService customerservice = 
(CustomerService)user.GetService(AdWordsService.v201502.CustomerService);
                long customerId = customerservice.get().customerId;
                AdWordsAppConfig config = (AdWordsAppConfig)user.Config;
                config.ClientCustomerId = customerId.ToString();
                lit.Text += config.ClientCustomerId.ToString();
                lit.Text += config.Email;

One more time I am thanking you for help.

Marcin Gdak 

W dniu piątek, 10 kwietnia 2015 17:36:12 UTC+2 użytkownik Anash P. Oommen 
(AdWords API Team) napisał:
>
> Hi Marcin,
>
> In your Web.config, comment out all the OAuth2 properties other than
>
>     <add key="OAuth2ClientId" value="INSERT_OAUTH2_CLIENT_ID_HERE" />
>     <add key="OAuth2ClientSecret" value="INSERT_OAUTH2_CLIENT_SECRET_HERE" 
> />
>     <add key="OAuth2Mode" value="APPLICATION" />
>
> When you do this, client library would see that both accessToken and 
> refreshToken are empty, and would then take you through the flow for 
> obtaining an access and refresh token. 
>
> As you mentioned, this call doesn't seem right:
>
> AdsClientLibs.RequestInfoLogs Information: 1 : 
> host=accounts.google.com,url=/o/oauth2/token,Content-Type: 
> application/x-www-form-urlencoded, Host: accounts.google.com, TimeStamp: 
> Wed, 08 Apr 2015 15:56:00 GMT, 
> code=4%2feZigbElUJzTfPvRzDcgvxolkIZFJ30jLAGbA3tmn_mY.snhw8qCGuzkbYFZr95uygvUB4KEymQI&client_id=524.....29-lsp7.......
> 6seth.apps.googleusercontent.com
> &client_secret=******&redirect_uri=http%3a%2f%2flocalhost%3a50246%2fOAuthLogin.aspx&grant_type=authorization_code&refresh_token=******,Result=Success
>
> A refresh_token=***** shouldn't be there, I'm assuming that's the 
> placeholder value being loaded from the Web.config you downloaded from the 
> nuget package.
>
> Cheers,
> Anash P. Oommen,
> AdWords API Advisor.
>
>
> On Friday, April 10, 2015 at 4:31:53 AM UTC-4, Marcin Gdak wrote:
>>
>> Hi Nadine,
>>
>> I understand my problem, but i don't know how to add access_type in my 
>> code. I added in webconfig, but it doesn't work.
>> I'm using the taken library from nuget packet.
>>
>> Could you help me?
>>
>> W dniu piątek, 10 kwietnia 2015 01:00:10 UTC+2 użytkownik Nadine 
>> Sundquist (AdWords API Team) napisał:
>>>
>>> Hello Marcin,
>>>
>>> In response to your questions:
>>>
>>>    - Parameter *access_type* should be offline.
>>>    - The POST address looks correct.
>>>
>>> One thing that I noticed that is different about your response from what 
>>> I would expect is that your are receiving an *id_token *rather than a 
>>> *refresh_token*. This means that you are using an OAuth 2.0 connection 
>>> mechanism called OpenID Connect 
>>> <https://developers.google.com/identity/protocols/OpenIDConnect>. Based 
>>> on the OpenID documentation related to retrieving tokens 
>>> <https://developers.google.com/identity/protocols/OpenIDConnect#exchangecode>,
>>>  
>>> you must make sure that your *access_type=offline* in order to get back 
>>> a refresh_token. 
>>>
>>> Cheers,
>>> Nadine, AdWords API Team
>>>
>>> On Wednesday, April 8, 2015 at 10:10:02 AM UTC-4, Marcin Gdak wrote:
>>>>
>>>> Hi Nadine,
>>>>
>>>> Still my refresh token is empty.
>>>> My logs:
>>>>
>>>>
>>>> AdsClientLibs.RequestInfoLogs Information: 1 : 
>>>> host=accounts.google.com,url=/o/oauth2/token,Content-Type: 
>>>> application/x-www-form-urlencoded, Host: accounts.google.com, 
>>>> TimeStamp: Wed, 08 Apr 2015 15:56:00 GMT, 
>>>> code=4%2feZigbElUJzTfPvRzDcgvxolkIZFJ30jLAGbA3tmn_mY.snhw8qCGuzkbYFZr95uygvUB4KEymQI&client_id=524.....29-lsp7.......
>>>> 6seth.apps.googleusercontent.com
>>>> &client_secret=******&redirect_uri=http%3a%2f%2flocalhost%3a50246%2fOAuthLogin.aspx&grant_type=authorization_code&refresh_token=******,Result=Success
>>>>
>>>>
>>>> AdsClientLibs.SoapXmlLogs Information: 1 : 
>>>> -----------------BEGIN API CALL---------------------
>>>>
>>>> Request
>>>> -------
>>>>
>>>> POST /o/oauth2/token
>>>> Content-Type: application/x-www-form-urlencoded
>>>> Host: accounts.google.com
>>>> TimeStamp: Wed, 08 Apr 2015 15:56:00 GMT
>>>>
>>>>
>>>> code=4%2feZ.....QI&client_id=524....029-l......
>>>> h.apps.googleusercontent.com
>>>> &client_secret=******&redirect_uri=http%3a%2f%2flocalhost%3a50246%2fOAuthLogin.aspx&grant_type=authorization_code&refresh_token=******
>>>>
>>>> Response
>>>> --------
>>>>
>>>> Pragma: no-cache
>>>> Content-Disposition: attachment; filename="json.txt"; 
>>>> filename*=UTF-8''json.txt
>>>> X-Content-Type-Options: nosniff
>>>> X-Frame-Options: SAMEORIGIN
>>>> X-XSS-Protection: 1; mode=block
>>>> Alternate-Protocol: 443:quic,p=0.5
>>>> Vary: Accept-Encoding
>>>> Transfer-Encoding: chunked
>>>> Accept-Ranges: none
>>>> Cache-Control: no-cache, no-store, max-age=0, must-revalidate
>>>> Content-Type: application/json; charset=utf-8
>>>> Date: Wed, 08 Apr 2015 13:56:01 GMT
>>>> Expires: Fri, 01 Jan 1990 00:00:00 GMT
>>>> Server: GSE
>>>> TimeStamp: Wed, 08 Apr 2015 15:56:01 GMT
>>>>
>>>>
>>>>
>>>> {"access_token":"******","token_type":"Bearer","expires_in":"3599","id_token":"eyJ...........................................................................................lSHBP3pZMtNCT6oSsOnaKbGUldOA"}
>>>> -----------------END API CALL-----------------------
>>>>
>>>> In my opinion, the server is not sending the refresh token back.
>>>>
>>>> I have a few questions.
>>>>
>>>> Parameter "access_type" should not be "offline"?
>>>> In request,  Post should not be "/o/oauth2/auth". In my request is 
>>>> "/o/oauth2/token"  
>>>>
>>>> Thank you for help.
>>>>
>>>>
>>>> W dniu piątek, 3 kwietnia 2015 18:03:00 UTC+2 użytkownik Nadine 
>>>> Sundquist (AdWords API Team) napisał:
>>>>>
>>>>> Hi Marcin,
>>>>>
>>>>> Let me recap the process that you're following. It should be this:
>>>>>
>>>>>    1. Follow the OAuth2 ASP.NET code example on how to do an OAuth2 
>>>>>    flow and capture the access and refresh token.
>>>>>    2. Set the access and refresh token to user.Config dynamically at 
>>>>>    runtime and call CustomerService.get()
>>>>>    3.  Set the customerId to user.Config dynamically and make further 
>>>>>    calls.
>>>>>
>>>>> Here are some troubleshooting tips on figuring out why your refresh 
>>>>> token is not coming back:
>>>>>
>>>>>    - You may have another login session active somewhere that is 
>>>>>    interfering with the flow. 
>>>>>       - Close the browser.
>>>>>       - Close the Visual Studio debugger web server (if it is 
>>>>>       accessible from the system tray).
>>>>>       - Try running through the whole flow again.
>>>>>    - If that does not work, the refresh token may not be making 
>>>>>    itself available to the flow.
>>>>>       - Turn on logging and see if the server is sending the refresh 
>>>>>       token back. The refresh token may be getting sent back, but the 
>>>>> client 
>>>>>       library may not be picking it up.
>>>>>       - Here's a guide 
>>>>>       
>>>>> <https://github.com/googleads/googleads-dotnet-lib/wiki/How-to-capture-SOAP-messages>
>>>>>  on 
>>>>>       capturing messages.
>>>>>    
>>>>> Best,
>>>>> Nadine, 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 http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/028aec56-67c3-4eb6-afdc-3ca2d74f37bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to