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

Token renewal not working as expected #14

Open
othmaneamane opened this issue Feb 27, 2025 · 0 comments
Open

Token renewal not working as expected #14

othmaneamane opened this issue Feb 27, 2025 · 0 comments

Comments

@othmaneamane
Copy link

After migrating from self hosted v0.98.0-postgres to v0.112.0-postgres, token renewal is not working anymore

Here is minimal code to reproduce (Universal Auth token with Access Token TTL = 120 and Access Token Max TTL = 25920000 & Access Token Max Number of Uses = 0) :

import { InfisicalSDK } from '@infisical/sdk';
const siteUrl = "my-domain"
const client = new InfisicalSDK({
  siteUrl,
});
const clientId = "xxxxxxxxxxxxx";
const clientSecret = "xxxxxxxxxxxxxxx";
await client.auth().universalAuth.login({
  clientId,
  clientSecret,
});
async function renewToken() {
    try {
        await client.auth().universalAuth.renew();
        console.log("Infisical token renewed successfully.");
    }
    catch (err) {
        console.error("Error renewing token:", err);
    }
}
const period = 30_000;
setInterval(renewToken, period);

The logs :

  • After 30 seconds : Infisical token renewed successfully.
  • After 60 seconds : Infisical token renewed successfully.
  • After 90 seconds : Infisical token renewed successfully.
  • After 120 seconds : InfisicalSDKError: [URL=http://my-domain/api/v1/auth/token/renew] [Method=post] [StatusCode=403] Your token has expired. Please re-authenticate.
  • After 150 seconds : InfisicalSDKError: [URL=http://my-domain/api/v1/auth/token/renew] [Method=post] [StatusCode=403] Your token has expired. Please re-authenticate.
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