# Discourse redirects to the OAuth server after loading \`/?authComplete=true\`

**URL:** https://meta.discourse.org/t/discourse-redirects-to-the-oauth-server-after-loading-authcomplete-true/115973
**Category:** SSO
**Created:** [25.Апрель.2019 15:51:00 UTC](https://meta.discourse.org/t/discourse-redirects-to-the-oauth-server-after-loading-authcomplete-true/115973 "2019-04-25T15:51:00Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)
#### Post date: [30.Апрель.2019 20:03:18 UTC](https://meta.discourse.org/t/discourse-redirects-to-the-oauth-server-after-loading-authcomplete-true/115973/4 "2019-04-30T20:03:18Z")

</div>

> [@david](#):
>
> I know @LeoMcA recently made some improvements here, so make sure you’re running a recent version of Discourse.

I explain the problem I was seeing (and link to the changes I make) in this topic: [Redirect after logout with full screen login](https://meta.discourse.org/t/redirect-after-logout-with-full-screen-login/109755)

The difference here is that the issue I faced only happened after logout, not during the login process (but I imagine the problem lies in a similar section of code).

> [@ryancey](#):
>
> When the user clicks the OAuth server confirmation link **in the same browser session** (used from the first step)

> [@ryancey](#):
>
> When the user clicks the OAuth server confirmation link **in a new browser session**

This kind of change in behaviour across sessions strikes me as cookie oddness, so maybe have a look there.

I’ve sorta-kinda managed to decrypt session store cookies on live Discourse sites by copying [this function](https://gist.github.com/LeoMcA/a3e3f5d2c1448b763c587f1c53f06180) into the rails console before, but it’s messy. For proper debugging I’d suggest running [a dev image in docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009) and adding this to `ApplicationController` to get it to print the current session cookie on every request.

```plaintext
before_action :print_session_cookie

def print_session_cookie
  pp session
end

```

> [@ryancey](#):
>
> I’m [already digging](https://github.com/discourse/discourse/search?q=authComplete&unscoped_q=authComplete) but some help would be appreciated.

I imagine you’re already doing this, but just in case you’re not, I wouldn’t rely on github search to do digging like this. I find Atom’s search (other text editors are available) far more fast and reliable.

---

_[View the full topic](https://meta.discourse.org/t/discourse-redirects-to-the-oauth-server-after-loading-authcomplete-true/115973)._
