Atlaf,

For the initial refresh token request, you will need the user interaction. 
 Afterwards, you can save the refresh token securely and re-use it to get 
access.  If your web application has multiple users each w/ different 
AdWords account, then you will need to properly implement OAuth 2.0 web 
flow.  Please see our migration guide 
<https://developers.google.com/adwords/api/docs/guides/clientlogin-to-oauth2-migration-guide>
.

Thanks,

Ray

On Monday, July 21, 2014 10:32:28 AM UTC-4, Altaf Mulla wrote:
>
> Hi ,
>
>  
>
> I downloaded the google adwords dotnet library with examples
>
>  
>
> I ran  the Oauth Project (…….examples\AdWords\csharp\oauth)
>
>  
>
> THis project has two aspx pages
>
>  
>
> I just added some code in the below function as follows
>
>  
>
>    private void DoAuth2Configuration(AdWordsAppConfig config) {
>
>  
>
>             config.Email = "te...@gmail.com";
>
>                 config.Password = "xxxxxxxxxxx!";
>
>                 config.UserAgent = "xxxxxxxxxxxx";
>
>                 config.DeveloperToken = "xxxxxxxxxxxxxxxxx";
>
>                 config.AuthorizationMethod = AdWordsAuthorizationMethod
> .OAuth2;
>
>                 config.ClientCustomerId = "123-456-789"
> .ToString().Replace("-", "");
>
>                 config.OAuth2ClientId = "
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com";
>
>                 config.OAuth2ClientSecret = "_xxxxxxxxxxxxxxxxxxxxxxxxx";
>
>       
>
>                 config.OAuth2RedirectUri = Request.Url.GetLeftPart(
> UriPartial.Path);
>
>       // Create an OAuth2 object for handling OAuth2 flow.
>
>       OAuth2ProviderForApplications oAuth = new 
> OAuth2ProviderForApplications(config);
>
>       if (Request.Params["state"] == null) {
>
>         // This is the first time this page is being loaded.
>
>         // Set the state variable to any value that helps you recognize
>
>         // when this url will be called by the OAuth2 server.
>
>         oAuth.State = "callback";
>
>  
>
>         // Create an authorization url and redirect the user to that page.
>
>         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("Default.aspx");
>
>       } else {
>
>         throw new Exception("Unknown state for OAuth callback.");
>
>       }
>
>     }
>
>  
>
> And then ran the application I was redirect to my google account  below 
> screen
>
>
> <https://lh5.googleusercontent.com/-d8XtCBZPhSk/U8fiBHcFMNI/AAAAAAAAAIQ/QYzEdMyoVoA/s1600/login.png>
>
>  
>
>  
>
> step 1 :After Entering Credentials I was redirected to the below screen
>
>
> <https://lh6.googleusercontent.com/-vefVy9qtwYM/U8fiPItm1eI/AAAAAAAAAIY/fXsPNJMJb7U/s1600/accept.jpg>
>
>  
>
>  
>
> Step 2 : After clicking Accept I was redirected to the default.aspx
>
>  
>
>
> <https://lh3.googleusercontent.com/-4HQCp0tbviE/U8fic3a42II/AAAAAAAAAIg/g7yBQtbjR0c/s1600/campaign.png>
>
>  
>
>  *After Entering the Customer ID I was able to get the Campaign Details*
>
>  
>
> *In this I came across that I need to login into my google adwords  
> Account , Click Accept*
>
> *In which the Application redirects an authoriztion URL When I click 
> accept I receive an authorization code*
>
> *Which I use to Fetch Access And Refresh Tokens Which is then used by the 
> google api (camapign Service )*
>
> *to get the campaign Details*
>
>  
>
> *Is there any way in which I can avoid the steps 1 and 2 so that I don’t 
> need to  Login and click Accept*
>
>  
>
> *Is there any way I can get the authorization code directly and use it to 
> Fetch Access And Refresh Tokens*
>
>  
>
> *As I have a web application in which my clients use the api to get 
> campaign details and statistics of campaign*
>
> *I don’t want then to go through these steps*
>
>  
>
> *Please Suggest *
>
>  
>
> *Thanks and Regards*
>
>
>
> On Monday, July 21, 2014 4:35:12 PM UTC+5:30, Altaf Mulla wrote:
>>
>> *Auth2 Authentication*
>>
>> *Is there any way in which I can avoid the process the  Login and click 
>> Accept *
>>
>> *Can i not use  the google adwords  api by setting my credentails 
>> ,developer token  ,etc* 
>>
>> *Is there any way I can get the authorization code directly and use it to 
>> Fetch Access And Refresh Tokens*
>>
>>  *As I have a web application in which my clients use the api to get 
>> campaign details and statistics of campaign*
>>
>> *I don’t want then to go through Login precodure and click of accept 
>> button for Auth2 authentication* 
>>
>> *Please Suggest *
>>
>>  
>>
>> *Thanks and Regards*
>>
>> *Altaf*
>>
>>  
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to