databricks-sdk-py icon indicating copy to clipboard operation
databricks-sdk-py copied to clipboard

[Fix] Initiate a new OAuth external browser login flow in case of refresh token exception

Open eric-wang-1990 opened this issue 1 year ago • 4 comments

What changes are proposed in this pull request?

This PR change the OAuth token cache that when the cached oauth token cannot be refreshed, we still wanna go trigger a new OAuth login flow instead of just throwing an exception. This help customers who use OAuth U2M, when their cached access token expire they have a way to continue rather than stuck with exception.

How is this tested?

Manual test from dbt-databricks.

eric-wang-1990 avatar Nov 15 '24 00:11 eric-wang-1990

Anything I can do to get this prioritized? We've been stuck on 0.17.0 for more than a year, and this is the last piece needed for us to finish our migration to fully relying on SDK for dbt-databricks auth and being able to use latest versions of SDK.

benc-db avatar Dec 05 '24 19:12 benc-db

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger: go/deco-tests-run/sdk-py

Inputs:

  • PR number: 823
  • Commit SHA: 61f0ddaa186d303f1489433696fc657f6ee41822

Checks will be approved automatically on success.

github-actions[bot] avatar Dec 10 '24 17:12 github-actions[bot]

@eric-wang-1990, I see you've re-assigned the PR to me but I cannot find any additional test in the code. Did you forget to commit the tests or is it that you need guidance to write them?

Just saw this, yeah I did not find any existing test about this cached token and I am not very familiar with this sdk codebase so I do not know where to add it. Can we land this fix first and then you guys can write the tests? Since dbt upgrade version is depending on this.

eric-wang-1990 avatar Jan 09 '25 17:01 eric-wang-1990

Hi, we need this fix too, as we are currently using a workaround by try-excepting and deleting the cached token file. If tests are necessary and I can assist, you would need to point me in the right direction :)

davidmikan avatar Jan 11 '25 13:01 davidmikan