AI OnAI Off
You can pass it in anonymous_id in the url and it will use that as id when it gets to the token. You can store the anonymous_id in a cookie and resend when you need to refresh,
const res = await fetch(`${Config.BASE_URL}api/episerver/connect/token/anonymous`, {
method: 'POST',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: qs.stringify({
grant_type: "anonymous",
client_id: "frontend",
scope: "anonymous_id",
anonymous_id: "4f6ba206-55df-4e0c-8e4e-6f4192631ee4"
}),
})
const data = await res.json();
Hello, I am currently working on implementing a guest user journey using grant type anonymous flow. The guest user should be able to add items to his cart and checkout. However, I am facing an issue with the anonymous flow; everytime I request an anonymous token using api/episerver/connect/token/anonymous everything that has been created or added items to the cart with that token won't work on a new one.
I have noticed that my token only lasts for an hour and no refresh token is returned. is there a way to be able to refresh this token or any way to keep the cart data if it expires?
I am open to any suggestions.
Thanks in advance.