Wix secret manager update and list function error

Question:
Im trying to update a secret manager value from the backend, but i keep receiving the same PERMISSION DENIED status 403 error

This is how the funtion currently looks

import { secrets } from 'wix-secrets-backend.v2';

export async function updateAuthToken() {
    const endpoints = await getEndpoints();
    const URL = endpoints['authentication']['token'];
    const refreshToken = await getSecret(SECRET_REFRESH_TOKEN_NAME);
    const newAuthTokenObject = await apiRequest('GET', URL, { refreshToken });
    const secret = {
      name: SECRET_AUTH_TOKEN_NAME,
      value: newAuthTokenObject.token,
      description: "Authentication token",
    };
    await wixSecretsBackend.updateSecret(ID_AUTH_SECRET,secret);
}

Product:
Velo secret manager functions

What are you trying to achieve:
We are connecting a API to our wix site, and require to update the api token with a refresh token every 24 hours

What have you already tried:
the listSecretInfo() funtion is also giving us error and we wonder if its related.

Additional information:

1 Like

Where is this function defined and where is it being called from?