Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] oauth2 does not reauthenticate after credentials time out #781

Open
misilot opened this issue Feb 29, 2024 · 5 comments
Open

[Bug] oauth2 does not reauthenticate after credentials time out #781

misilot opened this issue Feb 29, 2024 · 5 comments
Labels
datasource/Infinity type/bug Something isn't working

Comments

@misilot
Copy link

misilot commented Feb 29, 2024

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.

@yesoreyeram
Copy link
Collaborator

Hiya.. sorry you are having trouble. We have be using oauth2 with several other providers without issue. Can you help us exact steps to reproduce with some endpoint which we can access.?

@yesoreyeram yesoreyeram added the type/bug Something isn't working label Mar 1, 2024
@jcpalumbo
Copy link

jcpalumbo commented May 10, 2024

Same issue here. The connection is made when doing the "Test and Save" via the health check screen. Then after the connection times out or I manually revoke the connection on the Salesforce side the 401 happen.
@yesoreyeram do you still need access to an endpoint where this is happening?

@yesoreyeram
Copy link
Collaborator

@jcpalumbo - Yes James. Still I need access to some endpoint where I should be able to reproduce the issue.

@jcpalumbo
Copy link

From what I can tell in my case Salesforce does not use a refresh token with the Client Credentials flow. Once the token expires you need to just get another token using the client id and secret. I should be able setup a sandbox connection for you to test if this makes since.

@gwdawson gwdawson moved this to Backlog in OSS Big Tent May 30, 2024
@gmarsay
Copy link

gmarsay commented Jul 3, 2024

Same problem, I get a 401 once my token is revoked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource/Infinity type/bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

4 participants