Skip to content

Commit 7d0a502

Browse files
committed
Avoid requests in recents without required token
Currently this results with a 401, and that humanizes to "token was rejected" but that is not quite right.
1 parent 7b1bcda commit 7d0a502

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt

+4
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
376376
settings.token(deploymentURL.toURL())?.first,
377377
)
378378

379+
if (client.token == null && settings.requireTokenAuth) {
380+
throw Exception("Unable to make request; token was not found in CLI config.")
381+
}
382+
379383
// Delete connections that have no workspace.
380384
val items = client.workspaces().flatMap { it.toAgentList() }
381385
connectionsByWorkspace.forEach { (name, connections) ->

0 commit comments

Comments
 (0)