I am facing 403 Forbidden error when I try to renew token. This error appears randomly and most of the time token gets renewed properly but sometimes I face this error. All my configuration including inactivity expiry and absolute expiry are set properly.
This is what my request looks like
const formData = {
grant_type: 'refresh_token',
client_id,
refresh_token: userSession?.refreshToken,
client_secret
};
const formBody = Object.entries(formData)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value as any)}`)
.join('&');
const tokenResponse = await fetch(`https://${config.AUTH0_DOMAIN}/oauth/token`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
},
body: formBody,
});```
And this is the response I get when it results in error
(url=https://dev-cdebase.auth0.com/oauth/token, status=403, statusText=Forbidden, ok=false, bodyUsed=true, size=0, timeout=0, _abort=false, _bytes=81)
--
headers: {
"_headers": {
"date": [
"Wed, 26 Oct 2022 22:14:40 GMT"
],
"content-type": [
"application/json"
],
"transfer-encoding": [
"chunked"
],
"connection": [
"close"
],
"cf-ray": [
"76068bd50889b045-ATL"
],
"cache-control": [
"private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0, no-transform"
],
"set-cookie": [
"did=s%3Av0%3A95e67440-557b-11ed-bc3e-0dcfdb6ab38c.Mq47px2BL3noMvEstS94C%2FOfBl2B2WiOkCZ9qIdzKNc; Max-Age=31557600; Path=/; Expires=Fri, 27 Oct 2023 04:14:40 GMT; HttpOnly; Secure; SameSite=None",
"did_compat=s%3Av0%3A95e67440-557b-11ed-bc3e-0dcfdb6ab38c.Mq47px2BL3noMvEstS94C%2FOfBl2B2WiOkCZ9qIdzKNc; Max-Age=31557600; Path=/; Expires=Fri, 27 Oct 2023 04:14:40 GMT; HttpOnly; Secure"
],
"strict-transport-security": [
"max-age=31536000"
],
"vary": [
"Accept-Encoding, Origin"
],
"cf-cache-status": [
"DYNAMIC"
],
"ot-baggage-auth0-request-id": [
"76068bd50889b045"
],
"ot-tracer-sampled": [
"true"
],
"ot-tracer-spanid": [
"4349817c1649d715"
],
"ot-tracer-traceid": [
"228e3efc230c5bcb"
],
"traceparent": [
"00-0000000000000000228e3efc230c5bcb-4349817c1649d715-01"
],
"tracestate": [
"auth0-request-id=76068bd50889b045,auth0=true"
],
"x-auth0-requestid": [
"bdfa963110f29b286003"
],
"x-content-type-options": [
"nosniff"
],
"x-ratelimit-limit": [
"30"
],
"x-ratelimit-remaining": [
"29"
],
"x-ratelimit-reset": [
"1666822481"
],
"server": [
"cloudflare"
],
"alt-svc": [
"h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400"
]
}
}
--