diff --git a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java index 41bc9c14deb7..fbb99c9461ea 100644 --- a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java +++ b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java @@ -65,6 +65,8 @@ import org.apache.iceberg.rest.auth.AuthManager; import org.apache.iceberg.rest.auth.AuthManagers; import org.apache.iceberg.rest.auth.AuthSession; +import org.apache.iceberg.rest.auth.OAuth2Properties; +import org.apache.iceberg.rest.auth.OAuth2Util; import org.apache.iceberg.rest.requests.CommitTransactionRequest; import org.apache.iceberg.rest.requests.CreateNamespaceRequest; import org.apache.iceberg.rest.requests.CreateTableRequest; @@ -414,6 +416,10 @@ public Table loadTable(SessionContext context, TableIdentifier identifier) { authManager.tableSession(finalIdentifier, tableConf, contextualSession); TableMetadata tableMetadata; + if (tableSession instanceof OAuth2Util.AuthSession) { + tableConf.put(OAuth2Properties.TOKEN, ((OAuth2Util.AuthSession) tableSession).token()); + } + if (snapshotMode == SnapshotMode.REFS) { tableMetadata = TableMetadata.buildFrom(response.tableMetadata())