You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m facing a consistent issue when trying to create or update documents in MasterData using the MasterData class from the @vtex/api package (version 6.48.0). Despite correctly extending the MasterData class, I cannot manipulate (create, update, or delete) records in a MasterData entity unless I set all fields in the entity to "Public access" (enabling "Allow editing without credentials" in the VTEX UI). This is not a secure practice and severely limits functionality in production environments.
Steps to Reproduce
I extend the MasterData class in my Node.js service as follows:
With VtexIdclientAutCookie in the headers, I receive a 403.
With X-VTEX-API-AppKey and X-VTEX-API-AppToken (uncommented in the constructor), I also receive a 403.
However, when testing the same appKey and appToken outside the service (using Postman or a direct HTTP request), operations in MasterData work correctly, indicating that the issue is not with the credentials themselves or their roles, but with how @vtex/api handles authentication or policies.
Additional Context
I’m working on a Node.js service using @vtex/api within a VTEX app.
The version of @vtex/api I’m using is 6.48.0.
The issue persists even with correctly configured policies in manifest.json and a valid IOContext provided by VTEX.
Enabling "Allow editing without credentials" resolves the issue but compromises security by making the data publicly accessible, which is not viable in production.
Impact
This issue blocks the core functionality of my app, as I cannot manage MasterData securely and programmatically from the service. Forcing the use of "Allow editing without credentials" is not a sustainable solution, and using VTEX’s raw API with appKey/appToken outside of @vtex/api is a temporary workaround that defeats the purpose of using this library.
Question
Is there a correct configuration or approach I’m missing to manipulate MasterData data from a service using @vtex/api? Could there be a bug in the MasterData implementation or in how authentication is handled with VtexIdclientAutCookie or appKey/appToken?
Notes
I’ve reviewed the @vtex/api documentation and examples in the repository but found no clear solution to this issue.
If needed, I can provide detailed logs, the full manifest.json, or the schema of the affected entity to aid in debugging.
The text was updated successfully, but these errors were encountered:
Description
I’m facing a consistent issue when trying to create or update documents in MasterData using the
MasterData
class from the@vtex/api
package (version 6.48.0). Despite correctly extending theMasterData
class, I cannot manipulate (create, update, or delete) records in a MasterData entity unless I set all fields in the entity to "Public access" (enabling "Allow editing without credentials" in the VTEX UI). This is not a secure practice and severely limits functionality in production environments.Steps to Reproduce
MasterData
class in my Node.js service as follows:SP
for StorePickup) using methods likecreateDocument
orupdatePartialDocument
:Expected Behavior
I should be able to create or update documents in MasterData using:
VtexIdclientAutCookie
token provided byIOContext.authToken
.X-VTEX-API-AppKey
andX-VTEX-API-AppToken
for authentication.This should work without requiring "Allow editing without credentials," respecting the access policies defined in my app’s
manifest.json
, such as:Current Behavior
VtexIdclientAutCookie
in the headers, I receive a 403.X-VTEX-API-AppKey
andX-VTEX-API-AppToken
(uncommented in the constructor), I also receive a 403.appKey
andappToken
outside the service (using Postman or a direct HTTP request), operations in MasterData work correctly, indicating that the issue is not with the credentials themselves or their roles, but with how@vtex/api
handles authentication or policies.Additional Context
@vtex/api
within a VTEX app.@vtex/api
I’m using is 6.48.0.manifest.json
and a validIOContext
provided by VTEX.Impact
This issue blocks the core functionality of my app, as I cannot manage MasterData securely and programmatically from the service. Forcing the use of "Allow editing without credentials" is not a sustainable solution, and using VTEX’s raw API with
appKey/appToken
outside of@vtex/api
is a temporary workaround that defeats the purpose of using this library.Question
Is there a correct configuration or approach I’m missing to manipulate MasterData data from a service using
@vtex/api
? Could there be a bug in theMasterData
implementation or in how authentication is handled withVtexIdclientAutCookie
orappKey/appToken
?Notes
@vtex/api
documentation and examples in the repository but found no clear solution to this issue.manifest.json
, or the schema of the affected entity to aid in debugging.The text was updated successfully, but these errors were encountered: