Hello I am creating a website that uses LinkedIn API. I have done everything as needed like my functions are in the backend and I also created secrets with the wix-secrets-backend to hide the sensitive keys. I must create one of the secrets in the code, but when I create it in “Preview” mode it works but in the live version of the site it returns an error: [“undefined, status: 403”], like I don’t have permission ? I have enabled permissions for anyone. Can someone please help me ?
Hi,
This probably means you don’t return a promise.
Can you post the code where you get the data from the backend.
Kind regards,
Kristof.
Hi, thanks for your response.
I’ve changed the logic so I only need to update the value of the secret in the code but still in the live site I get error with status 403.
Even if I just try to list the secrets I get the error too.
This is the function:
export function updateSecret(code) {
return wixSecretsBackend.listSecretInfo().then((secrets) => {
const newSecret = {
value: code,
}
return wixSecretsBackend.updateSecret(secrets[ 2 ].id, newSecret);
})
. catch ((error) => {
console.error(error);
});
}
Please post the URL and explain where and how to see the problem.
https://elena2171.wixsite.com/sofiarecruitment/application-form
This is the url.
When the “Apply with linkedin” button is pressed I call this function from my backend:
export function updateSecret(code) {
return wixSecretsBackend.listSecretInfo().then((secrets) => {
const newSecret = {
value: code,
};
return wixSecretsBackend.updateSecret(secrets[ 2 ].id, newSecret);
}). catch ((error) => {
console.error(error);
});
}
It returns an error: [“undefined, status: 403”], even if I just call wixSecretsBackend.listSecretInfo(). And this happens only on the live site. In the editor it works.
Im also having trouble, if i fire the commend from the editor it will create the secret, but calling it from a html page as a test fails with Error500
Have you got any further with it ?
Derek
@derek68213 Hello, yes I figured out, that you cannot change or create “secrets” from your live site, unless you are logged in as administrator. Since my site doesn’t have any login functionality I stored what I needed in the wix database.
yes i was beginning to think the same, I tried to use the backend Login Function hoping that would cure the authentication but it does not seem to work either
I will create the secret from the management page
Pity it would have been nice though
Thanks for responding