Is there api for user sign out?

I found how to deacivate/delete user with api but I need to sign out the deleted user out after delete. Wonder whether there is also api for this? Thanks in advance!

@leonking is this for signing out of Okta or a specific app e.g. OIDC app? Also, you can use the following APIs to close a user’s session i.e. sign them out:

See Close Session in the Sessions API reference for more information on removing a specific session.

See Clear User Sessions in the Users API reference for more information on removing all of a user’s sessions.

Thanks @sigama and I will take a look later!
When I deactivate/delete a user and I got CORS problem and I tried a lot but still could not get it resolved. Can you help please?
My delete fetch like this:
fetch(‘https://xxxx.okta.com/api/v1/users/’ + useID,{
method: ‘DELETE’,
headers:{‘Content-type’:‘application/json’,
‘Accept’: ‘application/json’,
‘cache-control’:‘no-cache’,
‘Access-Control-Allow-Origin’:’*’,
‘Authorization’:‘SSWS *****’
},
body: {}
}).then(res=>{
if(res){
}
}).catch(error => {
});

The error msg is below:
Access to fetch at ‘https://dev-xxxx.okta.com/api/v1/users/00u2xn8gjtbbFZgbO5d9’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource…
BTW, I can do deactivate user with postman and do not know why I can’t from UI?

The /api/v1/users/${user_id} endpoint is not CORS enabled.
https://developer.okta.com/docs/reference/api/users/#deactivate-user

Are you looking for /api/v1/sessions/me endpoint instead for logging the user out, which is CORS enabled?
https://developer.okta.com/docs/reference/api/sessions/#close-current-session

Thanks! @warren
I have a question even if the 1st one (method: ‘DELETE’) is not CORS enabled but looks like it still do the work by an alternative way like below. Is this the right way to deal with “not CORS enabled” or is there other way to delete user from okta? The 2nd one is just killing the session not delete user, I guess. Thanks!

}).catch(error => {
if(error == ‘TypeError: Failed to fetch’) {
console.log(“delete ok”);
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.