subash bosh
subash bosh

Reputation: 1

OKTA Delete user session API is failing in angularjs

I am using OKTA default APIs( /api/v1/users/${userId}/sessions) for closing session across all the devices. The functionality is working as expected but the status is showing the API call is failed.
And also when we validate through Postman the 204 response code is returning but in angularjs the API call is failing.

Below is the API reference page which I have used in my application https://developer.okta.com/docs/reference/api/users/#user-sessions

Please find the attached screenshot for your reference

click here

Postman Response

click here

Upvotes: 0

Views: 492

Answers (1)

subash bosh
subash bosh

Reputation: 1

There are few OKTA APIs which will support backend only for security reasons. So I have added client.endAllUserSessions(user.id)" method in my backend to remove user session across all devices. It is working fine for me.

(/api/v1/users/${userId}/sessions) API is failed in front end So we should call the "client.endAllUserSessions(user.id)" method in backend(Node JS) to clear user session.

For older okta-sdk-nodejs versions We Should call "client.endAllUserSessions(user.id)" method. For latest okta-sdk-nodejs versions We Should call "client.clearUserSessions(user.id)" method.

Thanks,

Subash.E

Upvotes: 0

Related Questions