Deleting Sessions
Problem
You want to delete a session.
Solution
Use the session GUID or follow the Finding Sessions recipe to get an integration, then use its delete()
method.
from posit import connect
= "d072bd83-b7b9-4064-80e4-d9b5689baf4d"
GUID
= connect.Client()
client = client.oauth.sessions.get(GUID)
session session.delete()
Follow the Finding Sessions recipe to get the session’s GUID, then use the connectapi
client to make a direct call to the sessions endpoint.
library(connectapi)
<- "d072bd83-b7b9-4064-80e4-d9b5689baf4d"
GUID
<- connect()
client $DELETE(paste0("v1/oauth/sessions/", GUID)) client
A successful response returns a 204 HTTP status code with an empty response.
://localhost:3939/__api__/v1/oauth/sessions/d072bd83-b7b9-4064-80e4-d9b5689baf4d]
Response [http: 2024-09-15 19:40
Date: 204
Status-Type: text/plain; charset=utf-8
Content<EMPTY BODY>
Discussion
All users can delete their own sessions. Only administrators can delete sessions for other users.
See also
- For more details about the data returned in this recipe, see Delete an OAuth session in the API Reference.
- See OAuth Integrations in the User Guide to learn more about how publishers and viewers interact with OAuth integrations.
- See OAuth Integrations in the Admin Guide to for more detailed information on how to configure OAuth integrations.