2

When we do an OAuth Flow, we get hold off an access token and a refresh token. Access tokens are short lived and when configured for snowflake's token parameter, the connection succeeds.

How do I configure refresh tokens with snowflake JDBC driver, in such a way that the driver uses a refresh token to get a new access token when the old one expires?

Is this supported in Snowflake JDBC driver?

4
  • I am not sure I understand the issue. Do you have OAuth setup like this and the settings not taking? Are you receiving a "authentication token expired" error? docs.snowflake.net/manuals/user-guide/… Then we also have this parameter if needed for JDBC to keep the session alive: docs.snowflake.net/manuals/sql-reference/… Commented Feb 4, 2020 at 19:00
  • My question is does snowflake JDBC driver is capable of using the refresh token to request for a new access token in a transparent way for the underlying application? or is it a job of the underlying application to get a new token whenever the access token expires? i think the validity of the access tokens are 10mins only. So, after 10mins i can not use the access token to establish a connection. Commented Feb 5, 2020 at 12:47
  • I think understand your question now. Yes, access tokens have validity set at 10 minutes and that cannot be changed. There's some configurable validity options with the refresh token when you setup OAuth integration. docs.snowflake.net/manuals/user-guide/… Commented Feb 6, 2020 at 0:42
  • So I've been looking into this as well.... I believe you'd need to handle the refresh yourself, but it might not be needed if you keep the connection open. From their FAQ: Please note that the validity of the token expires in 600 secs from the time it is generated but if the token is used within those 600 seconds to establish a session from a client, then the session will be active as per the session configuration of the account/user. community.snowflake.com/s/article/FAQs-Snowflake-OAuth Commented Feb 20, 2024 at 1:34

1 Answer 1

0

According to the code, I think the only way for the driver to handle token refresh is to use OKTA authentication.

I have the same problem and don't think it's possible with the driver. Take a look to the method newSession in SFSession.class.

I use snowflake jdbc driver version 3.13.27.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.