Merge branch 'oauth-revoke' into 'develop'
Revoke OAuth token on logout, fixes #445 Closes #445 See merge request soapbox-pub/soapbox-fe!271
This commit is contained in:
commit
35d99f0beb
|
@ -145,7 +145,17 @@ export function logIn(username, password) {
|
||||||
|
|
||||||
export function logOut() {
|
export function logOut() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
const state = getState();
|
||||||
|
|
||||||
dispatch({ type: AUTH_LOGGED_OUT });
|
dispatch({ type: AUTH_LOGGED_OUT });
|
||||||
|
|
||||||
|
// Attempt to destroy OAuth token on logout
|
||||||
|
api(getState).post('/oauth/revoke', {
|
||||||
|
client_id: state.getIn(['auth', 'app', 'client_id']),
|
||||||
|
client_secret: state.getIn(['auth', 'app', 'client_secret']),
|
||||||
|
token: state.getIn(['auth', 'user', 'access_token']),
|
||||||
|
});
|
||||||
|
|
||||||
dispatch(showAlert('Successfully logged out.', ''));
|
dispatch(showAlert('Successfully logged out.', ''));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue