strava-datasource: Strava datasource cannot connect to Strava API - Bad Request or 401 Unauthorized

I installed strava plugin into Grafana. I tried to configure datasource with both options OAuth and Refresh token, bot none of them works.

OAuth

image

When I press Connect with STRASVA, new tab is opened with error:

{
  "message": "Bad Request",
  "errors": [
    {
      "resource": "Application",
      "field": "redirect_uri",
      "code": "invalid"
    }
  ]
}

Refresh token

image

This option show information, that Data source is working.

When I open New Dashboard and switch to my Strava datasource, I receive immediately 401 error:

image

From Strava API dashboard I can see, api calls have been made: image

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 5
  • Comments: 42 (1 by maintainers)

Most upvoted comments

Ok, maybe docker is a source of problem. I’ll test it out.

@GKG-ctrl seems like the problem is here:

Error saving refresh token" err="Get "/api/datasources/uid/fdgr8jy7j3caoa": unsupported protocol scheme ""

I’ll take a look, maybe something was changed in latest grafana

Just updated to 1.7.1 and finally worked for me. Thank you so much!

I’ve made some fixes and improvements in auth process, you can upgrade to 1.7.1 and try again. Not sure it fixes your error, I could not manage to replicate it exactly, but have some related fixes.

I was able to get it working, here is what I did: I am using grafana 10.2.0 and promethes:v2.47.2, both are running in docker. Firstly I removed completely the strava plugin and installed it again from here https://grafana.com/grafana/plugins/grafana-strava-datasource/?tab=installation using grafana-cli plugins install grafana-strava-datasource Then i followed this guy from this Youtube tutorial, only where he is configuring his connection to Strava and it worked! https://youtu.be/CgP9hs9UDzA?si=oMk1L-w4Bf75khTW&t=188

I’m facing same the same issue.

  • Grafana Cloud
  • Plugin v1.6.1
  • Forward OAuth identity = false
  • Plugin auth via OAuth => enter client id and secret, redirect to Strave and accept, back to Grafan and click “Save and Test” = “Data source is working. Authenticated as …”

When I click Explore view, I get “Error Status: 401 Unauthorized” when exploring the Strava data source.

If I set “Forward OAuth identity” = true, and click “Save and Test”, I also get a 401

If I choose “Auth Type” = “refresh token”, and enter details from Strava API application (client id and secret + refresh token), then “Save and Test” always fails.

@mdrocan yes, in case you use grafana at raspberry pi, you need to configure callback domain to exact address you use to open grafana (raspberrypi.local or IP address, depends on how you access it).

@natellium Unfortunately, there’s an issue with Grafana cloud. Since instance starts in the new container every time, the only available long-term storage is a DB. But plugin do not have access to DB, so refresh token will be removed on instance restart.

@mdrocan I updated configuration docs, hope it’s more clear now.

@dorinand I added the correct intranet’s IP address to Strava’s API definition (https://www.strava.com/settings/api) , ie. “Authorization Callback Domain”. Ie. I had ‘localhost’ defined there, like mentioned in https://github.com/grafana/strava-datasource/blob/master/docs/configuration.md, which didn’t work. Instead the correct IP address works.

@quentinlegay just tried clearing my cache as well as trying a different browser and I’m met with the same result (401 unauthorized)