waynerobinson / xeroizer

Xero accounting system API library.
http://waynerobinson.github.com/xeroizer
Other
238 stars 311 forks source link

Client `expires_at` is `nil` when `#authorize_from_access` is used #490

Closed pond closed 3 years ago

pond commented 5 years ago

In a Partner Application client instance initialised with an access token via #authorize_from_access rather than #authorize_from_request, the client's expires_at and authorization_expires_at values return nil. This is quite destructive since Xeroizer has no automated renewal and raises exceptions for expired tokens, making control flow in any non-trivial application very difficult. One cannot proactively defend against unexpected expiry exceptions via renewal based on token expiry date.

We've had to kludge around this by storing expiry data in our settings store but that's messy. Either the expires_at/authorization_expires_at accessors should work in all cases, or they should be removed.

CloCkWeRX commented 4 years ago

Do you want to see if this is still an issue with the revised oauth2 work merged into master from #500 and #503 ?

I haven't poked around under the hood to see if it's Xero API side or Xeroizer side.

mcfiredrill commented 4 years ago

I'm also seeing null for expire_at when using renew_access_token.

pond commented 4 years ago

@CloCkWeRX Thanks for the reply & suggestion.

I didn't notice the OAuth 2 work until you mentioned it. The PRs appear to contain a huge amount of work; this does make me a bit nervous about early adoption. I see no references at all to any of this in the top level README.md though - has the gem itself remained entirely 100% API compatible with its clients but now talks OAuth 2 "under the hood", or are there as-yet-undocumented things one must do in order to invoke OAuth 2 support?

rjaus commented 3 years ago

v3 of wrapper deprecates OAuth1. In alignment with XeroAPI deprecated OAuth1.

See PR: https://github.com/waynerobinson/xeroizer/pull/542