SSO credentials validity / forced logout

You can make an API request to /admin/users/<discourse_user_id>/log_out. The WP Discourse plugin uses this route to sync logging out of WordPress with Discourse. You could probably copy most of the code from this function: wp-discourse/lib/sso-provider/discourse-sso.php at main · discourse/wp-discourse · GitHub.