# Remove inactive users which were SSO enabled

**URL:** <https://forum.buildkite.community/t/remove-inactive-users-which-were-sso-enabled/3232>\
**Category:** General\
**Created:** [September 4, 2023, 10:08am UTC](https://forum.buildkite.community/t/remove-inactive-users-which-were-sso-enabled/3232 "2023-09-04T10:08:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akki](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@akki](https://forum.buildkite.community/u/akki)\
**Post date:** [September 4, 2023, 10:08am UTC](https://forum.buildkite.community/t/remove-inactive-users-which-were-sso-enabled/3232/1 "2023-09-04T10:08:25Z")

</div>

Hi, I was looking for some graphql query or REST API query which can give me list of users who are inactive and are SSO enabled.  
I try to dig in,but no luck. Can someone help me around this?

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![karen.sawrey](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/karen.sawrey/32/1188_2.png) [@karen.sawrey](https://forum.buildkite.community/u/karen.sawrey)\
**Post date:** [September 4, 2023, 2:20pm UTC](https://forum.buildkite.community/t/remove-inactive-users-which-were-sso-enabled/3232/2 "2023-09-04T14:20:56Z")

</div>

Hello, @akki! Welcome to the Community!

To be able to query the users who are not active for the last N hours, you need to [update the SSO session duration](https://buildkite.com/docs/apis/graphql/cookbooks/organizations#update-the-default-sso-provider-session-duration) to N hours. After that, you could [query the most recent SSO sign-in for all users](https://buildkite.com/docs/apis/graphql/cookbooks/organizations#get-the-most-recent-sso-sign-in-for-all-users) and then [remove the users](https://buildkite.com/docs/pipelines/permissions) who weren’t active within that N-hour period you specified earlier from Buildkite using GraphQL.

Please keep it in mind that if the SSO session is kept alive for a long time, it doesn’t really indicate recent activity - just the fact that the users were signed in via SSO.

Best!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/system/32/1321_2.png) [@system](https://forum.buildkite.community/u/system)\
**Post date:** [September 7, 2023, 10:08am UTC](https://forum.buildkite.community/t/remove-inactive-users-which-were-sso-enabled/3232/3 "2023-09-07T10:08:29Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
