This tutorial demonstrates how to work with wix-secrets-backend.v2, along with wix-fetch, wix-auth and wix-web-module to securely retrieve data from a 3rd party API.
The tutorial contains code in two files:
- HOME - triggers the call to the backend file, and receives the data to be displayed to the site visitor.
- BACKEND/GETDATA.WEB.JS - securely retrieves a key stored in the Secrets Manager and applies it to the third party API URL as an authentification key.
To use this code on your Wix Studio website, watch the video tutoral here: https://www.youtube.com/watch?v=93E7Ei5gPNM or follow these steps:
- Create an API key on the 3rd party API of your choice.
- Store the API key in the Secrets Manager.
- Modify the code in the GETDATA.WEB.JS file to retrieve the secret's value, and call the API. Test the API call using the run functions button.
- Once received, the data can be used anywhere on your site.
For more info visit https://www.wix.com/velo/reference/wix-secrets-backend-v2