For simplicity’s sake, here is my use case: I’m making a website that’s essentially a wrapper around Keyword Planner’s ability to see the monthly search volume of a keyword.
My question is around the OAuth2 authentication. I’m having a hard time wrapping my head around what needs to happen regarding authentication each time a user of the site makes a keyword request against the API. I’m building it in Ruby on Rails. I’ve got my test/sandbox AdWords account all set up, I’ve got my oauth2 client id, secret, developer token, and customer id in the config file. Running the code in this example <https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/examples/v201509/misc/setup_oauth2.rb>, I am able to get a verification code, which is then exchanged for a *Refresh token*, and *Access token* (which I guess expires in 60 minutes). So, all is nice and good, I am able to run this code <https://github.com/googleads/google-api-ads-ruby/blob/607ed3168d92497b19677c8cd60b4f054818fbfb/adwords_api/examples/v201509/optimization/get_keyword_ideas.rb> against the TargetingIdeaService and get results. The part that confounds me is the *Refresh token* and *Access token* expiring. I just need any user to be able to come to the site and make an API call, and it be transparent to them what’s going on with authentication. The sample setup_oauth2.rb <https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/examples/v201509/misc/setup_oauth2.rb#L23> Ruby code writes to the *adwords_api.yml* file (in the console, it prompts me if I want to do so). If this was code *not* run from the console, how would I make sure my tokens are valid/up to date with each request? -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/a5a39b92-d4a0-412f-804f-7c33c8970bfb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.