Error while running 'ruby setup_oauth2.rb' while setting up the client library

59 views
Skip to first unread message

Arjun Rajkumar

unread,
Mar 27, 2017, 10:43:22 AM3/27/17
to AdWords API Forum
Hey, 

I am new to the Adwords API and have been trying to set this up for a while. 
I was following the steps on this page : 
I got stuck at this step - run 'ruby setup_oauth2.rb' from the console. 

I pasted the setup_oauth2.rb file from here (https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/examples/v201609/misc/setup_oauth2.rb) into my rails app under the config directory. 
 
Then I went into the console and ran 'ruby setup_oauth2.rb' - but am getting `initialize': No such file or directory @ rb_sysopen - /Users/arjunrajkumar1/adwords_api.yml '
The adwords_api.yml file is also placed in the config directory. 
Maybe my file path in 'setup_oauth2.rb' to adwords_api.yml is wrong? 

Can someone please guide me how to fix this? 

Really appreciate it. 

Thanks

Arjun

Vishal Vinayak (Adwords API Team)

unread,
Mar 27, 2017, 4:03:24 PM3/27/17
to AdWords API Forum
Hi Arjun,

That is correct. The adwords_api.yml file needs to be available in the home directory of the user (i.e. Users/arjunrajkumar1 in your case). Could you please copy the file in your home directory and see if that works? If you have custom setting for your home directory path, please ensure that the file is available in the path specified as home in your system. 

Regards,
Vishal, AdWords API Team
Message has been deleted

Arjun Rajkumar

unread,
Mar 28, 2017, 2:04:26 AM3/28/17
to AdWords API Forum
Hi Vishal, 

This works fine from the console. 

But via the Rails app when I require the adwords_api file in the login controller, I am getting the same error I got before in console.
'Cannot load such a file'. 
Any idea how I could fix this in the Rails app?

Thanks

Arjun

Vishal Vinayak (Adwords API Team)

unread,
Mar 28, 2017, 11:33:56 AM3/28/17
to AdWords API Forum
Hi Arjun,

You may see a USER_PERMISSION_DENIED error if there is no link between the manager account (authenticated via OAuth credentials) and the client AdWords account (specified in the request header). Could you also perform a ManagedCustomerService.get() request to see if your client account is linked to your manager account? Regarding the other issue, could you please open a new issue on the Ruby client library github repository, since this looks particular to the client library?
Reply all
Reply to author
Forward
0 new messages