login.OAuthLogin (NewTransportWithCode) after OAuth login

Hi all,

I have encountered this error message after I entered the id and password on the redirect fusionAuth page.

The docker log is showing things like:

t=2022-11-23T05:55:20+0000 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/login/generic_oauth status=302 remote_addr=xxx time_ms=4 size=305 referer=http://grafana.staged-by-discourse.com/login
t=2022-11-23T05:55:32+0000 lvl=info msg="state check" logger=oauth queryState=xxx cookieState=xxx
t=2022-11-23T05:55:32+0000 lvl=eror msg=login.OAuthLogin(NewTransportWithCode) logger=context userId=0 orgId=0 uname= error="Post \"http://localhost:9011/oauth2/token\": dial tcp 127.0.0.1:9011: connect: connection refused"
t=2022-11-23T05:55:32+0000 lvl=eror msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/login/generic_oauth status=500 remote_addr=xxx time_ms=9 size=1365 referer=http://localhost:9011/

and the network gives back 500 internal server error


More info:
Here is the Grafana setting

- GF_SERVER_DOMAIN=localhost
- GF_SERVER_HTTP_PORT=3000
- GF_SERVER_PROTOCOL=http
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=password
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_GENERIC_OAUTH_ENABLED=true
- GF_AUTH_GENERIC_OAUTH_CLIENT_ID=xxx
- GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET=xxx
- GF_AUTH_GENERIC_OAUTH_AUTH_URL=http://localhost:9011/oauth2/authorize
- GF_AUTH_GENERIC_OAUTH_TOKEN_URL=http://localhost:9011/oauth2/token
- GF_AUTH_GENERIC_OAUTH_API_URL=http://localhost:9011/oauth2/userinfo
- GF_AUTH_GENERIC_OAUTH_USE_PKCE=true

The direct login on Grafana without OAuth is working properly.
I am using Docker compose to build up Grafana and other services, they are connected with bridge network and communicating properly.
The OAuth login was working fine before, but suddenly no longer be able to redirect back to Grafana dashboard, not sure if I did anything wrong :frowning:
Can anyone help with this problem?

Apparently your Grafana container can’t connect to GF_AUTH_GENERIC_OAUTH_TOKEN_URL. It looks like you have http://localhost:9011/oauth2/token\ instead of http://localhost:9011/oauth2/token there. Or that localhost is a problem (but you didn’t publish how did you expose IDP on localhost in the Grafana container, so I don’t know).

Thank you for the reply!
I have checked that there was a typo in the error message, and now corrected it back.
I created an application for Grafana and attached to the fusionAuth user I use, the GF_AUTH_GENERIC_OAUTH_CLIENT_ID and GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET are where I put the application client details in.

Hello, can I know what was the fix and what was the typo error in detail please. I have got the same error also can you let me know what was the call back url format