# Any way to force login popup to open by url query string?

**URL:** <https://meta.discourse.org/t/any-way-to-force-login-popup-to-open-by-url-query-string/46193>\
**Category:** Feature\
**Created:** [2016年六月22日 15:43 UTC](https://meta.discourse.org/t/any-way-to-force-login-popup-to-open-by-url-query-string/46193 "2016-06-22T15:43:36Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ngm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ngm/32/113693_2.png) [@ngm](https://meta.discourse.org/u/ngm)\
**Post date:** [2018年十月8日 17:32 UTC](https://meta.discourse.org/t/any-way-to-force-login-popup-to-open-by-url-query-string/46193/5 "2018-10-08T17:32:50Z")

</div>

I’ve got a similar question. Although not to display the login popup, but to log the user in via our SSO provider if there is a `login` query string parameter.

- We use our own system as the SSO provider to Discourse.
- We have a mixture of public and private pages on our Discourse, so we don’t have `login_required` set.
- If a user authenticates in to our system, and we link them to our Discourse root url, they are shown the public categories but are not logged in.
- If a user authenticates in to our system, and we link them to our Discourse + /login, they are logged in fine, and redirected to the root Discourse URL.
- If a user authenticates in to our system, and we link them to the URL of a private category/topic in Discourse, they are shown a page asking them to login. If they click Login, they are automatically logged in and shown the category/topic.

This last case is the problematic one. I think one of the following would be good:

- we can link to ourdiscourse dot com/c/some-category?login=true and an auth check is performed - if user is logged in, show them the topic. If not, send them to our SSO provider, and redirect them back to the topic after logging in.
- we can link to ourdiscourse dot com/login?redirect=c/some-category and an auth check is performed - if successful, redirect to the page on the query string, if not, redirect to SSO provider, and redirect to the page on the query string after successful authentication
- we can link to ourdiscourse dot com/c/some-category, and if it’s a private page, Discourse performs an auth check, which if successful takes you to the category; if not successful, redirects to SSO provider, then redirects back.

Thanks!

---

_[View the full topic](https://meta.discourse.org/t/any-way-to-force-login-popup-to-open-by-url-query-string/46193)._
