OKTA Authenticated but returns 504 on Grafana

Grafana Version: 7.0.3
Chrome Version: Version 83.0.4103.97

Issue Description:
Am trying to front my grafana app with Okta. My okta config looks like this
[auth.okta]
name = Okta
enabled = true
allow_sign_up = false
client_id = <my_client_id>
client_secret = <my_client_secret>
scopes = openid profile email
auth_url = https://<company_id>.okta.com/oauth2/v1/authorize
token_url = https://<company_id>.okta.com/oauth2/v1/token
api_url = https://<company_id>.okta.com/oauth2/v1/userinfo
allowed_domains = <company_domain>
;allowed_groups =
;role_attribute_path =

Checked with my Okta admin. The request gets successfully authenticated on Okta and the tokens get generated as expected. However, the request times out when coming back to grafana from Okta. I’ve tried to set the logs to debug but this is all I got.

Logs
t=2020-06-18T20:32:43+0000 lvl=info msg="state check" logger=oauth queryState=<some_value> cookieState=<some_value>

Network Tab

Please advise.

It is not clear which Grafana’s URL returns 504. You are saying 504 is returned, but screenshot of the network tab doesn’t say that - I don’t see any 504 response there - why? “took too long to respond” - what is too long - how many seconds? Why you don’t show more logs to see what is Grafana doing? Are you sure that you have configured/applied debug level properly when you see only info log level - e.g. GF_LOG_LEVEL=debug?

I was missing environment proxy variables: HTTPS_PROXY, NO_PROXY and http_proxy in /etc/sysconfig/grafana-server