authenticated connect without interaction: adds tiled.client.from_provider#1318
Open
authenticated connect without interaction: adds tiled.client.from_provider#1318
Conversation
Contributor
prjemian
commented
Mar 25, 2026
- closes Authenticated connect without interaction #1316
Addresses #1316. Adds tiled.client.from_provider(uri, provider, username, password) which connects to a tiled server and authenticates via an OAuth2 password grant without triggering the interactive login flow. Validates that the provider uses internal (password-based) mode, forwards node_path_parts and structure_clients to from_context(), and sets has_external_auth to prevent double-authentication. Co-authored-by: OpenCode (claudeopus46)
14 mock-based tests covering provider resolution, token handling, has_external_auth flag, structure_clients/node_path_parts forwarding, mode validation (internal, password, external), error propagation, and first-match semantics. Adapted from tests provided in issue #1316. Co-authored-by: OpenCode (claudeopus46)
Wrap long import lines in tests/test_client.py and tiled/client/__init__.py for isort, and wrap long from_provider() calls for black (88-char limit). Co-authored-by: OpenCode (claudeopus46)
Revert RuntimeError formatting to match black 23.10.1 used by pre-commit in CI, which differs from black 26.x. Co-authored-by: OpenCode (claudeopus46)
Contributor
Author
|
@danielballan, @DiamondJoseph : all tests pass, ready to review |
Contributor
Author
|
Tested at APS with the NeXus example file: In [1]: import yaml
In [2]: creds = yaml.safe_load(open(".test_creds.yml"))
In [3]: from tiled.client import from_provider
In [4]: client = from_provider("http://localhost:8020", "APS-DM-API", "jemian", creds["jemian"]["password"])
In [5]: client["dm/jemian-2602/data/NeXus/writer_1_3/Scan/data/counts"]
Out[5]: <ArrayClient shape=(31,) chunks=((31,)) dtype=int32> |
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.