I found this topic and similar here, when I digging how to solve O365 authorization problem after moving server behind a proxy.
For those who will come to this topic from search, take into an account two points:
- Check if
force_https
option is enabled. - If your Discourse is behind an SSL proxy, try the setting
proxy_set_header X-Forwarded-Proto "https";
in Nginx config of your Discourse server.