Revoke oAuth token

This commit is contained in:
Egor Kislitsyn 2019-07-02 15:33:40 +07:00
parent 221db9f210
commit 52319acf58
3 changed files with 50 additions and 9 deletions

View file

@ -125,13 +125,28 @@ const verifyRecoveryCode = ({app, instance, mfaToken, code}) => {
}).then((data) => data.json())
}
const revokeToken = ({ app, instance, token }) => {
const url = `${instance}/oauth/revoke`
const form = new window.FormData()
form.append('client_id', app.clientId)
form.append('client_secret', app.clientSecret)
form.append('token', token)
return window.fetch(url, {
method: 'POST',
body: form
}).then((data) => data.json())
}
const oauth = {
login,
getToken,
getTokenWithCredentials,
getOrCreateApp,
verifyOTPCode,
verifyRecoveryCode
verifyRecoveryCode,
revokeToken
}
export default oauth