Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Google OAuth broken in unified docker image #4839

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@

SECURE_REDIRECT_EXEMPT = env.list("DJANGO_SECURE_REDIRECT_EXEMPT", default=[])
SECURE_REFERRER_POLICY = env.str("DJANGO_SECURE_REFERRER_POLICY", default="same-origin")
SECURE_CROSS_ORIGIN_OPENER_POLICY = env.str("DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY", default="same-origin")
SECURE_SSL_HOST = env.str("DJANGO_SECURE_SSL_HOST", default=None)
SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=False)

Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ services:
# Enable Task Processor
TASK_RUN_METHOD: TASK_PROCESSOR # other options are: SYNCHRONOUSLY, SEPARATE_THREAD (default)

# Uncomment if you want to enable Google OAuth. Note this does not turn Google OAuth on. You still need to use
# Flagsmith on Flagsmith to enable it - https://docs.flagsmith.com/deployment/#oauth_google
# DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY: 'same-origin-allow-popups'

# For more info on configuring E-Mails - https://docs.flagsmith.com/deployment/locally-api#environment-variables
# Example SMTP:
# EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
Expand Down
11 changes: 11 additions & 0 deletions docs/docs/deployment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,17 @@ Create an OAuth application in the Google Developer Console and then provide the
}
```

If you are using the [unified Docker image](https://hub.docker.com/repository/docker/flagsmith/flagsmith), which serves
both the API and the frontend through Django, ensure you configure the following environment variable in your
deployment:

```
DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY=same-origin-allow-popups
```

For those hosting the frontend independently, make sure you set the `Cross-Origin-Opener-Policy` to
`same-origin-allow-popups` for Google OAuth flow to work.

### Dark Mode

We also have a Segment that manages the ui Dark Mode:
Expand Down
Loading