Skip to content

Commit

Permalink
Issue #6: add support for auth with OIDC refresh tokens + device code
Browse files Browse the repository at this point in the history
for local development
  • Loading branch information
soxofaan committed Apr 28, 2023
1 parent ff9574b commit 167e37f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"schema",
"pytest-timeout",
"shapely",
"openeo>=0.8.3a2.*",
"openeo>=0.17.0a3.*",
"pytest-xdist",
"xarray<2022.6.0",
"pyproj",
Expand Down
12 changes: 9 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ def auth_connection2(connection) -> openeo.Connection:
connection.authenticate_oidc_client_credentials(**service_account_creds, store_refresh_token=False)
return connection

# Try classic OIDC refresh tokens + device code flow
# TODO #6 use a really short `max_poll_time` here
# connection.authenticate_oidc()
# Try classic OIDC refresh tokens + device code flow:
# allows developers to run the integration tests locally with own user.
_log.info("Trying auth `connection.authenticate_oidc()` with refresh tokens + device code flow")
connection.authenticate_oidc(
# Note the really short default max poll time to fail fast by default
# (when nobody is watching the device code flow instructions).
max_poll_time=int(os.environ.get("OPENEO_OIDC_DEVICE_CODE_MAX_POLL_TIME") or 1),
store_refresh_token=True,
)

except Exception as e:
_log.error(f"Failed to authenticate with OIDC: {e}", exc_info=True)
Expand Down

0 comments on commit 167e37f

Please sign in to comment.