grafana-infinity-datasource icon indicating copy to clipboard operation
grafana-infinity-datasource copied to clipboard

[Bug] oauth2 does not reauthenticate after credentials time out

Open misilot opened this issue 1 year ago • 5 comments
trafficstars

Describe the bug

oauth2 credentials are not refreshed with the refresh_token, or a new access_token is not requested after getting 401 error.

Steps to reproduce

Setup Datasource with OAuth2 and wait try and use it after the token expires.

Sample Data

Error:

grafana-1  | logger=plugin.yesoreyeram-infinity-datasource t=2024-02-29T22:56:33.595876483Z level=info msg="performing QueryData in infinity datasource" dsName="Sensource Traffic" filterExpression= settings.OAuth2Settings.OAuth2Type=client_credentials uql= url=https://vea.sensourceinc.com/api/sensor parser=simple pluginID=yesoreyeram-infinity-datasource root_selector= source=url summarizeExpression= endpoint=queryData uname="Library SysAdmin" dsUID=fb59f297-8028-4b2b-8a7e-6a4c550b51cc settings.AuthenticationMethod=oauth2 type=json
grafana-1  | logger=plugin.yesoreyeram-infinity-datasource t=2024-02-29T22:56:33.607778125Z level=error msg="error while performing the infinity query" dsUID=fb59f297-8028-4b2b-8a7e-6a4c550b51cc pluginID=yesoreyeram-infinity-datasource uname="Library SysAdmin" dsName="Sensource Traffic" endpoint=queryData msg="401 Unauthorized"
grafana-1  | logger=context userId=1 orgId=1 uname=admin t=2024-02-29T22:56:33.609358772Z level=info msg="Request Completed" method=POST path=/api/ds/query status=400 remote_addr=68.102.21.228 time_ms=21 duration=21.737161ms size=8113 referer="https://dashboard/d/cf59f75b-4812-4675-bf18-4d1a625c2126/sensource?editIndex=0&editview=templating&orgId=1" handler=/api/ds/query

Version Details:

  • Grafana version : Grafana v10.3.3 (252761264e)
  • Plugin version : 2.5.0-beta.1

Additional context

Add any other context about the problem here.

misilot avatar Feb 29 '24 23:02 misilot