Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle OAuth connections that require manually updating the token #2175

Open
aiguofer opened this issue Feb 19, 2024 · 0 comments
Open

Comments

@aiguofer
Copy link

aiguofer commented Feb 19, 2024

We currently have a server that maintains a connection pool to various DataWarehouses and we want to enable OAuth connections for Snowflake, but I'm struggling to figure out how to make it work with HikariCP.

Snowflake access tokens last for 10 minutes, and we'll have an external client that handles the OAuth flow and passes the Access Token back to the server when making requests. This client will handle token refreshes, so when the access token changes it'll simply pass along the new access token for subsequent requests. Here's some docs on the general flow: https://community.snowflake.com/s/article/HOW-TO-OAUTH-TOKEN-GENERATION-USING-SNOWFLAKE-CUSTOM-OAUTH

My initial thought is that I can:

  • Set maxLifetime to 10 minutes
  • On each request, call dataSource.addDataSourceProperty("token", accessToken)

Would this be enough to force Hikari to pick up the changed property when re-creating a connection?
Is there some other recommended alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant