dbeaver / dbeaver/dbeaver

Failure to authenticate to GCP Cloud Sql

Open
#21,204 5 comments 0 reactions 1 assignee Claimed by @LonwoLonwo View on GitHub
PRO x:postgresql xf:connection
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 13h
Merged PRs (30d)
183

Description

### Description

As you can see below, when attempting to use IAM authn there is an internal exception thrown due to attempting to refresh a token. This applies to attempts to use SSO as well. ![image](https://github.com/dbeaver/dbeaver/assets/140558546/253916de-582c-43de-adc8-d8190b861b50)

Trying to use my SSO GCP password _or_ `Enable IAM` fails with the above dialog. . Unclear whether this is an integration bug, something lying at a lower-level 3rd party lib, or a misconfig on my part?

The relevant stacktrace from `.../.metadata.log`:

```
!ENTRY org.jkiss.dbeaver.model 4 0 2023-09-13 14:17:18.404
1183 │ !MESSAGE OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.
1184 │ !STACK 0
1185 │ java.lang.IllegalStateException: OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.
1186 │ at com.google.auth.oauth2.OAuth2Credentials.refreshAccessToken(OAuth2Credentials.java:365)
1187 │ at com.google.auth.oauth2.OAuth2Credentials$1.call(OAuth2Credentials.java:257)
1188 │ at com.google.auth.oauth2.OAuth2Credentials$1.call(OAuth2Credentials.java:254)
1189 │ at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
1190 │ at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
1191 │ at com.google.auth.oauth2.OAuth2Credentials$AsyncRefreshResult.executeIfNew(OAuth2Credentials.java:580)
1192 │ at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:180)
1193 │ at com.google.cloud.sql.core.CloudSqlInstance.fetchEphemeralCertificate(CloudSqlInstance.java:525)
1194 │ at com.google.cloud.sql.core.CloudSqlInstance.lambda$performRefresh$0(CloudSqlInstance.java:332)
1195 │ at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
1196 │ at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
1197 │ at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
1198 │ at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
1199 │ at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
1200 │ at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
1201 │ at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
1202 │ at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
1203 │ at java.base/java.lang.Thread.run(Unknown Source)
```

See the [docs](https://cloud.google.com/java/docs/reference/google-auth-library/latest/com.google.auth.oauth2.OAuth2Credentials#com_google_auth_oauth2_OAuth2Credentials_refreshAccessToken__) for more info.

### DBeaver Version

Lite Edition Version 23.2.0.202309120446

### Operating System

macOS Ventura 13.2.1

### Database and driver

1. Postgresql 15.x via Google Cloud SQL
2. GCP - PostgreSQL (gcp-postgres-jdbc)

### Steps to reproduce

1. Roughly, follow the instructions provided [here](https://dbeaver.com/docs/dbeaver/GCP-SSO/).

### Additional context

This also happens when I attempt to use a GCP service account and specify a key file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.