Which version of the SDK are you using?
1.10.0
A quick summary and/or background
Discovered this issue when debugging refresh token issues with @RettBehrens .
If scope is passed as a str (or another type) rather than a list in the token set to the helper method store_xero_oauth2_token, then refresh_oauth2_token will return None rather than the refreshed token set.
Steps to reproduce
- Pass
scopes as a space delimited string within the token set passed to an store_xero_oauth2_token
- Call
refresh_oauth2_token
- Verify the return value of
refresh_oauth2_token is None
What you expected would happen
- Pass
scopes as a space delimited string within the token set passed to an store_xero_oauth2_token
- Call
refresh_oauth2_token
can_refresh_access_token raises an error describing why the token cannot be refreshed: in this case, the error should state that scope must be a list of str
What actually happens
- Pass
scopes as a space delimited string within the token set passed to an store_xero_oauth2_token
- Call
refresh_oauth2_token
- Since the return value of
refresh_oauth2_token is not needed since store_xero_oauth2_token is called internally within refresh_oauth2_token, the issue is invisible and a silent failure occurs
- The issue becomes known when the access token expires since it can never be refreshed due to failing type validation
Which version of the SDK are you using?
1.10.0
A quick summary and/or background
Discovered this issue when debugging refresh token issues with @RettBehrens .
If
scopeis passed as astr(or another type) rather than alistin the token set to the helper methodstore_xero_oauth2_token, thenrefresh_oauth2_tokenwill returnNonerather than the refreshed token set.Steps to reproduce
scopesas a space delimited string within the token set passed to anstore_xero_oauth2_tokenrefresh_oauth2_tokenrefresh_oauth2_tokenisNoneWhat you expected would happen
scopesas a space delimited string within the token set passed to anstore_xero_oauth2_tokenrefresh_oauth2_tokencan_refresh_access_tokenraises an error describing why the token cannot be refreshed: in this case, the error should state that scope must be alistofstrWhat actually happens
scopesas a space delimited string within the token set passed to anstore_xero_oauth2_tokenrefresh_oauth2_tokenrefresh_oauth2_tokenis not needed sincestore_xero_oauth2_tokenis called internally withinrefresh_oauth2_token, the issue is invisible and a silent failure occurs