You can do this with DiscourseConnect (with Discourse functioning as the auth provider): Use Discourse as an identity provider (SSO, DiscourseConnect).
I haven’t tried it yet, but the prompt
parameter might be useful for your case:
prompt
: Ifprompt=none
, then the SSO request is treated as a “just checking” request. If the browser/device is already logged-in to Discourse, Discourse will return a successful SSO response bearing user authentication information, as usual. If the browser/device is not already logged-in, then Discourse will not ask the user to log in, and will immediately return an SSO response bearing the parameterfailed=true
instead of user information. This provides a mechanism to query if the user is logged-in, without ever directing the user to a login dialog if they are not.