-
Notifications
You must be signed in to change notification settings - Fork 468
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
Connect() with a new Azure SQL Auth Token doesnt update the connection, causing Token Expired error #1122
Comments
Sorry, I should mention that I know my Azure Token is refreshed as I log the value of it. |
can you show what kind of context this is being ran in? Does all of the code you posted run everytime you hit an endpoint? |
Are you closing the pool before you try to connect again? it won't use the new config when you call connect if the pool is already connected |
@cameronstubber You need to establish a new connection after your app will receive a new token because tedious does not support injecting token generator. You could also try another authentication method, like using Service Principal Secret. This more about |
A code sample is much appreciated. |
I provide an authenticated Azure AD Token in the Connection Options, which is good for 60 minutes, to the Connect() function. I track the token value over time, and once it has been refreshed, I call Connect() with a new Connection Options containing the new token. The token does not get updated within node-mssql/tedious, and eventually the SQL Connection stops working and returns token-expired errors.
I'm sure this is probably just a lack of understanding on how to use the module to manage the connection pool with regards to Azure Tokens. Any help would be awesome.
The AzureLogin class is my own, it just tracks the TTL of the current token and asks for a new one and saves it if required.
Expected behaviour:
I expected that calling connect with a new token, would update the token value within the Connection Pool / Manager.
Actual behaviour:
The token value does not change, and I get a Token Expired error.
Configuration:
Software versions
The text was updated successfully, but these errors were encountered: