Error decoding user info JSON: [Generic OAuth2]

Hello, I made own app that handle OAuth2 Authentication - when I wanna to get for example userdata via Postman - all works fine.

When I trying to use generic oauth2 to join grafana I see this problem:
"t=2019-09-22T23:10:35+0200 lvl=eror msg=“login.OAuthLogin(get info from generic_oauth)” logger=context userId=0 orgId=0 uname= error=“Error decoding user info JSON: invalid character ‘<’ looking for beginning of value”

Data from browser:


I am fighting with this error for three days without progress and I have no ideas how can I solve it. Can anybody help me?

You are not able to exchange code for token (error from 1st screenshot) - check logs of your IDP ( It looks like some error in html format is returned from token endpoint instead of proper response.

Thank you for you answer.
I made analysis the OAuth flow via wireshark. Token is successfully exchanged. The problem is when request is comming to the AUTH Server from Grafana.

When I am sending after exchange process to Auth Server request by Rester(app like Postman) there is no that problem -> I can see in app info from endpoint.

I attached below the picture where we can see difference between request to the AUTH Server.

any suggestion which parameter may affect the lack of authorization? By analysis HTTP details ofc.

Hello again. Jan thank for your answer. I don’t have errors from IDP.

Basing on the picture above we can see that token exchange went well (code 200 from oauth/token with json object in return). The problem is after: when request comming to the endpoint.

Above also I uploaded the HTTP OAuth flow from “Rester” - it is something like Postman. In this example token is received successfully and after when request arrives to the endpoint, auth server giving right answer (json userID endpoint).

And finally: By analysis the HTTP details (request to the endpoint) we can see differences between queries to the authorization server. I’m not sure which PARAMETER is responsible for the lack of authorization.
Any suggestion?

Why you are not using /user/userinfo (api_url) in Grafana? Why did you configure /user/getEmployeeList? You can see that Grafana was redirected to /login and text/html response was returned (so there is invalid ‘<’ character - html login page).