Thank for your replies :)

I have another problem. I am working with the option 2. 

My code:
AdWordsUser user = new AdWordsUser();
CustomerService customerservice = 
(CustomerService)user.GetService(AdWordsService.v201502.CustomerService);
long customerId = customerservice.get().customerId;     -> Here I am 
getting the error, that in webconfig I must have refreshToken.

My Authentication code:

Site from Redirect URIs

protected void Page_Load(object sender, EventArgs e)
        {
            AdWordsAppConfig config = new AdWordsAppConfig();
            if (config.OAuth2Mode == OAuth2Flow.APPLICATION &&
                 string.IsNullOrEmpty(config.OAuth2RefreshToken))
            {
                DoAuth2Configuration(config);
            }
            if (!string.IsNullOrEmpty(config.OAuth2RefreshToken))
            {
                Response.Redirect("/Pages/Default.aspx");
            }
        }
        private void DoAuth2Configuration(AdWordsAppConfig config)
        {
        config.OAuth2RedirectUri = Request.Url.GetLeftPart(UriPartial.Path);
        OAuth2ProviderForApplications oAuth =
                new OAuth2ProviderForApplications(config);
            if (Request.Params["state"] == null)
            {
            oAuth.State = "callback";
                Response.Redirect(oAuth.GetAuthorizationUrl());
            }
            else if (Request.Params["state"] == "callback")
            {oAuth.FetchAccessAndRefreshTokens(Request.Params["code"]);
               Session["OAuthProvider"] = oAuth;
                // Redirect the user to the main page.
               Response.Redirect("Pages/Default.aspx");
            }

I would like to write in webconfig refreshtoken after the authorization, 
but oAuth.RefreshToken is null. How can i get RefreshToken from my 
Authorization code? I don't understand it :(

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/1af5814b-9a44-45a8-9871-d047c7b5633d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to