Good morning everyone.
I am trying to use one of the graphQL apps provided by VTEX (vtex.search-graphql@0.48.0) to get product’s price by regionID. But instead of using the appKey and appToken this specific endpoint uses the VtexIdclientAutCookie. My question is: is there any way to generate this cookie using an api call?
We need to have this autcookie always available, since it expires in a day and it can render our endpoint useless.
3 Likes
Hello @Galdino1000, welcome to VTEX Community!
Usually you would get this cookie from the IO app’s context:
-
ctx.authToken
: token for the app itself
-
ctx.vtex.storeUserAuthToken
: token for actions on behalf of a store user
-
ctx.vtex.adminUserAuthToken
: token for actions on behalf of an admin user
You can see some more details in this documentation. Is this how you are currently authenticating?
I believe we do have some restrictions related to expiring cookies needing to be renewed… If you can’t solve your case with the information I shared let me know and I’ll see if I can figure out a way to renew cookies that works for your application.
Hello George.
Actually we are going to share this endpoint with a third-party partner with no access with the current code we are implementing (Criteo, which is a platform specialized in custom shelves built in-realtime using javascript), so they do not have access to VTEX context.
Is there a way to give/implement/renew the token to this third-party partner?
Hi Galdino, sorry for the delayed response. I would probably make the requests to vtex.search-graphql
from a middleware developed in VTEX IO for the specific purpose of exposing a specific endpoint to Criteo.
That way, your app would be able to get a product’s price by region ID with the tokens in the IO context, and send them over to Criteo with whatever authentication policy you want to define for them, without having to relay the token to them. Does that make sense?