[Alokai x SFCC] Token issue regarding SFCC custom endpoint call
Hi experts,
We created a custom endpoint on our SFCC instance and everything works fine through postman with the same credentials used in our .env.
The issue comes with the customization we brought to Alokai in the SFCC integration to extend it.
Here is what we've done :
- extended the integration
- installed axios
- retreive the
cookie context.req.cookies['vsf-sfcc-scapi-token'];
- put the token as a Bearer Auth in our request
We used jwt.io to decode the token since it doesn't work and the token seems to have placeholders in it (like __ORG_ID__
or __SLAS_CLIENT_ID__
)
If we generate a new token through context.client.AuthFacade.guestSignIn();
the call works fine but generating a new token at every request is not a valid solution.
So my question is how are we supposed to retrieve the current valid token (I guess there is alredy the mechanism to refresh it if it expires ?). Are we doing the right thing using axios ? Maybe there is already an http client with the correct header for our calls ? If so how are we supposed to retrieve it ?
Thanks for your help.
Kind regards0 Replies