1

I want to connect to snowflake database and it is using OAuth 2.0 how to connect with the database. I am able to connect initially (after running the springboot application) but after an hour its showing Oauth Token Expired.

I have registered my application using Azure AD and got client id, secret, scope, grantType for token generation

I am currently receiving the token using WebClient and passing it as a password to the Datasource connection. I know that the connection pool is not using the updated password how to configure it and is there any better way than WebClient or Am I missing anything? I am working on production is DriverManager a good approach or DataSource.

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented May 14, 2024 at 12:57

1 Answer 1

0

The OAuth access token is short-lived.

If the token is for the user, you can request a refresh token from the authorization server.

Using the grant type refresh_token where you renew the access token using the refresh token.

But if the access token is for the client, then in this case, the user is not present; hence, it is expected that a new access token will be requested when the current access token expires.

Hence if you have the access token generated for the user, you can use the refresh_token flow to renew the access token.

Refer to the following article which talks about the same. Oauth External for the user.

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.