Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct scopes for OAuth U2M and M2M flows #228

Merged
merged 6 commits into from
Feb 5, 2024

Conversation

kravets-levko
Copy link
Contributor

Fixes #226

This PR also contains some preparation work/refactoring, and is easier to review commit by commit:

  • explicitly define which flow to use (04011e4). We still rely on presense of clientSecret option, but now this condition is moved all the way up to DBSQLClient. OAuthManager uses dedicated option to choose which flow to use
  • when refreshing token, use the same scope as when getting the one (d587eb2). U2M and M2M flows refresh token in a different way (M2M actually just obtains a new token). Previously we hard-coded scopes for M2M refresh, but, since Azure and In-House OAuth need different scopes, instead of adding one more hard-code we save token's scopes when obtaining one, and then use the same scope when "refreshing"
  • fix Azure scopes for M2M flow (9f1c540)

Signed-off-by: Levko Kravets <levko.ne@gmail.com>
…ting the one

Signed-off-by: Levko Kravets <levko.ne@gmail.com>
Signed-off-by: Levko Kravets <levko.ne@gmail.com>
Signed-off-by: Levko Kravets <levko.ne@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (3953e5d) 0.00% compared to head (e82d2ed) 90.67%.

Files Patch % Lines
...ib/connection/auth/DatabricksOAuth/OAuthManager.ts 96.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main     #228       +/-   ##
=========================================
+ Coverage      0   90.67%   +90.67%     
=========================================
  Files         0       62       +62     
  Lines         0     1458     +1458     
  Branches      0      250      +250     
=========================================
+ Hits          0     1322     +1322     
- Misses        0       84       +84     
- Partials      0       52       +52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kravets-levko kravets-levko merged commit 957791b into main Feb 5, 2024
8 checks passed
@kravets-levko kravets-levko deleted the fix-azure-m2m-flow branch February 5, 2024 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invalid_scope in DBSQLClient
3 participants