Skip to main content
Question

Error while trying to revoke token

  • May 22, 2025
  • 2 replies
  • 11 views

Forum|alt.badge.img

Hi,

 

I have been able to successfully login using my app's client secret & id but I can't revoke users' auth token as I keep on getting CORS related error

 

 

const data = `client_id=${clientId}&client_secret=${clientSecret}&token=${refresh_token}`

axios
.post('https://api.box.com/oauth2/revoke', data, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
})
.then(() => {
console.log('Logout success')
dispatch({ type: USER_LOGOUT })
})
.catch(error => console.error(error))

window.fetch(`https://api.box.com/oauth2/revoke`, {
method: 'POST',
body: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}).then(() => {
console.log('Logout success')
dispatch({type: USER_LOGOUT})
}).catch(error => console.error(error))

 

I made the post request using both fetch and axis but I get the same error. Any ideas on what's going wrong here?

 

Appreciate all the help!

 

EDIT: I am using oAuth2 for user authentication

2 replies

Forum|alt.badge.img

I got the same problem.


Forum|alt.badge.img

I'm getting the same error, but if you try to re-use the access token to make another API request it gives me 401, which means the token is actually revoked.

 

This issue is posted since 2017 and no solution from Box yet :(.