Comments (10)
I worked around this by providing an expires_at value in my config.
The problem is that if the OAuth2 client doesn't have that value it's never going to be considered expired and the access token won't be generated.
from google-api-ads-ruby.
@dklimkin are you still working on issue #27 to add a library method to enforce the refresh. If not, i would like to make a pull request if it's possible.
from google-api-ads-ruby.
@mcloonan is currently maintaining the library. You are very welcome to send a pull request, please see:
https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/CONTRIBUTING.md
from google-api-ads-ruby.
@dklimkin @mcloonan thank you, I will send a PR ASAP.
from google-api-ads-ruby.
I found the same error on running https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/examples/v201506/misc/use_runtime_config.rb with refresh token.
Any update on this issue?
from google-api-ads-ruby.
Thank you for the report, and I apologize that this slipped through the cracks. Since it seems @huydx may not be providing the pull request, I'll take a look at implementing a solution myself.
from google-api-ads-ruby.
@offthecuff Could you please be more specific? What is the exact place where did you provide expires_at
?
from google-api-ads-ruby.
@Gataniel, It goes in the oauth2_token
subsection of the authentication hash. Piggybacking off the example from @huydx , this is what i have:
adwords = AdwordsApi::Api.new({
:authentication => {
:method => 'OAuth2',
:oauth2_client_id => client_id,
:oauth2_client_secret => client_secret,
:developer_token => developer_token,
:client_customer_id => client_customer_id
:user_agent => user_agent,
:oauth2_token => {
:refresh_token => refresh_token,
:expires_at => 0
}
},
:service => {
:environment => 'PRODUCTION'
}
})
from google-api-ads-ruby.
This is the issue in a nutshell.
This method will return false if expires_at is nil.
def expired?
return self.expires_at != nil && Time.now >= self.expires_at
end
At this point the client is not nil, but it will not be expired either so no token is created.
def get_token(credentials = nil)
token = super(credentials)
token = refresh_token! if !@client.nil? && @client.expired?
return token
end
To me this honestly seems like a deficiency in the signet gem, but I suppose this might be the intended behavior.
from google-api-ads-ruby.
Since there's a workaround and the issue seems to be with Signet, I'm going to close this out. It might be worth filing a bug with Signet directly if this is still an issue for you.
from google-api-ads-ruby.
Related Issues (20)
- Support for incremental oauth
- ReportableType is unexpected when creating CustomTargetingKey HOT 1
- Creating Callout Extensions in Adwords HOT 1
- Occurred error after entering verification code
- How to perform authentication client side? HOT 2
- Got "Unable to parse response body" from Ruby ad manager api HOT 3
- File permissions issue in google-dfp-api-1.11.0 and google-dfp-api-1.12.0 gems HOT 6
- `download_report_as_stream` ignores HTTP status code HOT 1
- GoogleAdsSavon::SOAP::InvalidResponseError Unable to parse response body HOT 2
- process GoogleAdsService.Search() never ends HOT 1
- Click Performance Report API endpoint failing with a Zlib buffer Error HOT 5
- Support Rails 6.1 HOT 5
- Will this library be sunset with Google AdWords API? HOT 1
- google-dfp-api gem 1.15.0 not compatible with Rails 5.2 HOT 1
- How to install google-adwords-api for version of Ruby lower than 2.2.2 HOT 1
- Default branch is now main
- My dreams officiall pakistan
- Out-Of-Band EOL
- Passing stateful information in initial authorization request? HOT 1
- 2.4.0 uses v202305 API version of Google Ad Manager, not v202308 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-api-ads-ruby.