feat(credentials): let users choose the account for interactive login (DM-3512) - #2730
Merged
yangru96 merged 2 commits intoAug 12, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for prompt and login_hint parameters to the interactive OAuth flow in OAuthInteractive and default_oauth_interactive across sync and async clients, enabling explicit account selection and login hints. Feedback was provided to use credentials.get("id_token_claims") or {} to defensively handle cases where the claims key exists but is None.
haakonvt
reviewed
Jul 30, 2026
OAuthInteractive silently used the first account it found in the token cache, so users signed in with several accounts had no way to choose and often ended up on the wrong one. Add prompt and login_hint to OAuthInteractive, its default_for_entra_id helper, (Async)CogniteClient.default_oauth_interactive and the YAML/JSON config accepted by load(). Pass prompt="select_account" to pick the account in the browser, or login_hint to name it up front and skip being asked. Once signed in, later token refreshes stay on that account without prompting again. Behavior change: when the token cache holds several accounts and neither argument is given, the browser now opens with an account picker instead of silently using an arbitrary account. A single cached account is still reused silently, so users with one account are unaffected.
yangru96
force-pushed
the
fix/interactive-login-multiple-accounts-dm-3512
branch
from
July 31, 2026 10:47
584a645 to
b0e826a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2730 +/- ##
==========================================
- Coverage 93.77% 93.77% -0.01%
==========================================
Files 513 513
Lines 52490 52620 +130
==========================================
+ Hits 49224 49345 +121
- Misses 3266 3275 +9
🚀 New features to boost your workflow:
|
haakonvt
reviewed
Aug 7, 2026
haakonvt
reviewed
Aug 7, 2026
haakonvt
approved these changes
Aug 7, 2026
haakonvt
left a comment
Contributor
There was a problem hiding this comment.
Great job with this! One comment re. docs otherwise LGTM
yangru96
enabled auto-merge
August 11, 2026 11:12
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 12, 2026
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
OAuthInteractive silently used the first account it found in the token cache, so users signed in with several accounts had no way to choose and often ended up on the wrong one.
Add
promptandlogin_hintto OAuthInteractive, itsdefault_for_entra_idhelper,(Async)CogniteClient.default_oauth_interactiveand the YAML/JSON config accepted byload(). Passprompt="select_account"to pick the account in the browser, orlogin_hintto name it up front and skip being asked. Once signed in, later token refreshes stay on that account without prompting again.Behavior change: when the token cache holds several accounts and neither argument is given, the browser now opens with an account picker instead of silently using an arbitrary account. A single cached account is still reused silently, so users with one account are unaffected.
Checklist: