Infinity Oauth2 authentication issue - cannot parse json: json: cannot unmarshal object into Go struct field tokenJSON.error of type string

  • What Grafana version and what operating system are you using?

Grafana version 10.4.2 and Windows

  • What are you trying to achieve?

I’m trying to set up a Oauth2 authentication using Infinity datasource to Arcgis portal.

  • How are you trying to achieve it?

Using the REST API provided by Arcgis - Generate Token | ArcGIS REST APIs | ArcGIS Developers.

  • What happened?

We’re expecting the server to response with json format after including the f parameter in the url header to specify it and we got this issue

oauth2: cannot parse json: json: cannot unmarshal object into Go struct field tokenJSON.error of type string

  • What did you expect to happen?
    Connection went successful and health check passed. Also it worked in postman or other API benchmarking tools so it should not be any wrong with the authenitcation method

That doesn’t look like Oauth2.

It is user authentication using Oauth2 protocol - Generate token flow | Documentation | Esri Developer

Are you trying to generate a token or retrieve data?

This flow adheres to the resource owner password credentials grant type defined in the OAuth 2.0 specification

See section 4.3.2: RFC 6749 - The OAuth 2.0 Authorization Framework

grant_type
REQUIRED. Value MUST be set to “password”.

Arcgis doesn’t use this REQUIRED/MUST parameter => it is not valid OAuth 2.0 (Resource Owner Password Credentials Grant) - it’s only similar.
So if Infinity follows OAuth 2.0 specification, then it is sending something different than Arcgix is expecting.

It will send a post request to ARcgis rest token to generate a token, and use that token to authentictae

is the result of that api call to fetch a token return a json?

yeap it return a json array

please post the json minus the token :wink:

1 Like