# Google auth error

**URL:** https://meta.discourse.org/t/google-auth-error/166510
**Category:** Support
**Created:** [October 7, 2020, 8:40am UTC](https://meta.discourse.org/t/google-auth-error/166510 "2020-10-07T08:40:29Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Kostya\_Vasilyev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kostya_vasilyev/32/194665_2.png) [@Kostya\_Vasilyev](https://meta.discourse.org/u/Kostya_Vasilyev)
#### Post date: [October 7, 2020, 8:40am UTC](https://meta.discourse.org/t/google-auth-error/166510/1 "2020-10-07T08:40:29Z")

</div>

Hello,

I’m new to Discourse. Recently created a forum and now in the process of moving the site and the forum to a new domain name.

The forum’s old domain: [https://forum.skymail.app](https://forum.skymail.app) (not active, redirects to new site)

New domain: [https://forum.sugarmail.app](https://forum.sugarmail.app) (operational)

Having trouble with Google auth. I’ve got a Google Cloud project, and after switching to the new domain, I also changed the redirect url under Client ID there, so currently it’s set to

`https://forum.sugarmail.app/auth/google_oauth2/callback`

Now the issue. When trying to “sign up with Google”, I get this error in Discourse:

`https://forum.sugarmail.app/auth/failure?message=csrf_detected Authorization timed out, or you have switched browsers. Please try again.`

When the forum was under the old domain, `forum.skymail.app`, Google auth worked without issue.

I did do `./launcher rebuild app` after changing the domain, making sure to update the domain in app.yaml under DISCOURSE\_HOSTNAME (in fact the forum wouldn’t load at all until I did that).

Any pointers please?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [October 7, 2020, 9:40am UTC](https://meta.discourse.org/t/google-auth-error/166510/2 "2020-10-07T09:40:28Z")

</div>

Normally, when you start the login flow, the `_forum_session` cookie is set in your browser. However, on your site, that doesn’t seem to be happening.

Do you have any plugins or proxies which could be intefering with the cookies on your site?

---

<div class="post-metadata">

### Author: ![Kostya\_Vasilyev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kostya_vasilyev/32/194665_2.png) [@Kostya\_Vasilyev](https://meta.discourse.org/u/Kostya_Vasilyev)
#### Post date: [October 7, 2020, 11:02am UTC](https://meta.discourse.org/t/google-auth-error/166510/3 "2020-10-07T11:02:20Z")

</div>

Thank you for the response.

Plugins - no, not using any. About the only thing I did after installation was to enable Google auth (client id and secret) and enabling “always use https”.

Proxies - I’m using nginx as a reverse proxy (which also serves the main app site).

```plaintext
    # discourse
    location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass_request_headers on;
            proxy_pass http://localhost:10080;
    }

```

and in containers/app.yaml

```plaintext
expose:
  - "10080:80" # http
  - "10443:443" # https

```

Let’s Encrypt in Discourse settings is not enabled. So the nginx inside the container is serving plain http, and the outside nginx add ssl termination.

These is almost same setup I had with the old domain, the only difference is “force https”.

I’m running 2.6.0.beta3.

---

<div class="post-metadata">

### Author: ![Kostya\_Vasilyev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kostya_vasilyev/32/194665_2.png) [@Kostya\_Vasilyev](https://meta.discourse.org/u/Kostya_Vasilyev)
#### Post date: [October 7, 2020, 11:05am UTC](https://meta.discourse.org/t/google-auth-error/166510/4 "2020-10-07T11:05:53Z")

</div>

Oh darn, it’s “force https” which I previously had off.

I enabled it recently, to avoid getting the warning in Chrome about “insecure page content” which was happening because of plain http links to images.

To reiterate, I do ssl termination in the “outside” nginx, and as far as Discouse itself goes, there is no ssl.

Turning off “force https” makes Google auth work again (I had to add a plain http redirect URL in the Google Cloud project).

But that’s not good because there will be “insecure site” / mixed content warnings as soon as there are images.

Is there a way to keep Google auth working with “force https” _and_ ssl termination outside of Discourse?

( I’d use Discourse’s own ssl support except it assumes that it “owns” the domain, so I’d need to set up an additional IP address for this VPS and separate the main site and the forum… which is a bit of a chore… )

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [October 7, 2020, 11:54am UTC](https://meta.discourse.org/t/google-auth-error/166510/5 "2020-10-07T11:54:12Z")

</div>

Make sure you’re sending along `X-Forwarded-Proto: https`.

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…

---

<div class="post-metadata">

### Author: ![Kostya\_Vasilyev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kostya_vasilyev/32/194665_2.png) [@Kostya\_Vasilyev](https://meta.discourse.org/u/Kostya_Vasilyev)
#### Post date: [October 7, 2020, 1:03pm UTC](https://meta.discourse.org/t/google-auth-error/166510/6 "2020-10-07T13:03:59Z")

</div>

Thank you @riking I’ve now copied the nginx block from your link verbatim, then then enabled “force https” as recommended by Discourse admin console.

My forum is back up and running now and Google auth is working.

An issue still persists, though:

Both Chrome and Firefox are giving me warnings about insecure page content.

Looking at network trace in Chrome dev tools, it’s this link (plain http, not https):

 ![129430568242d1b7f853bb13ebea28b3f6af4e72512x512](https://global.discourse-cdn.com/meta/original/3X/3/4/342105778d67ef2ecc322b85378a1c8d5ce56a58.png)

---

<div class="post-metadata">

### Author: ![Kostya\_Vasilyev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kostya_vasilyev/32/194665_2.png) [@Kostya\_Vasilyev](https://meta.discourse.org/u/Kostya_Vasilyev)
#### Post date: [October 7, 2020, 1:05pm UTC](https://meta.discourse.org/t/google-auth-error/166510/7 "2020-10-07T13:05:32Z")

</div>

> [@Kostya\_Vasilyev](#):
>
> Looking at network trace in Chrome dev tools, it’s this link (plain http, not https):

Ah, never mind. I just set a new, custom favicon and it’s now fetched using https. No mo “mixed content” warnings.

Beautiful, thanks for your help!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 6, 2020, 1:17pm UTC](https://meta.discourse.org/t/google-auth-error/166510/8 "2020-11-06T13:17:57Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
