This error is similar both for Google and Facebook. In my configuration there was a line in nginx:
# proxy_set_header X-Forwarded-Proto $https;
After I changed it to
proxy_set_header X-Forwarded-Proto $scheme;
the error has gone.
Solution was found after reading this topic: Redirect URI mismatch in Google Auth