500 Server Side Error - "Invalid API Key"

After implementing Generic Oauth in the Grafana.ini file, After clicking the “Sign in with Oauth” button an Internal Server Error and says to check the logs. The log error below is “Invalid API Key”.

I’m using Authorization Code grant type and all my endpoints for token and auth and api URLs are correct.

Is this Invalid API Key error coming from Grafana? If so why would it expect an API key when I’m using Authorization Code that uses clientID and clientSecret?

This error is not coming from the Autorization Server because I manually created these clientID and clientSecret in the OAuth Client management tool, which only accept clientID and ClientSecret. So this API key error must be coming from Grafana just need to know where in the Grafana.ini file do I need to explicitly say to not use API key and only use clientID and clientSecret.

t=2019-03-29T22:43:43+0000 lvl=eror msg="Invalid API key" logger=context error="Invalid Api Key"
t=2019-03-29T22:43:43+0000 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/login/generic_oauth status=401 remote_addr=172.17.0.1 time_ms=0 size=29 referer=
t=2019-03-29T22:43:43+0000 lvl=eror msg="login.OAuthLogin(get info from generic_oauth)" logger=context userId=0 orgId=0 uname= error="Error getting user info: {\"message\":\"Invalid API key\"}"
t=2019-03-29T22:43:43+0000 lvl=eror msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/login/generic_oauth status=500 remote_addr=10.128.116.167 time_ms=691 size=1731 referer=https://grafana-dev.pri.services-exchange.com:3000/login

Your questions are missing useful information. For example your full Grafana config in this case, which may help to replicate your issue. See generic recommendation https://stackoverflow.com/help/how-to-ask

It looks like your userinfo oauth endpoint (api_url) returned error {\"message\":\"Invalid API key\"}". Probably, because your wrong oauth configuration.