Building the Power BI Strava data connector

UPDATE: Strava has changed its auth method, I pushed out a temporary fix that should at least get you to load the data. You have to make sure you have cleared the permissions under data source settings for Strava. After you do this you need to log in and load the data, this will work for a few hours and then you will have to do clearing step again. I need to implement token refresh logic but that is quite some work.

UPDATE2: Some folks get a javascript error on authentication, this is because Strava has stopped IE support which Power BI supports. There is a workaround if you have the December 2020 or newer version of Power BI desktop that is described here:

I love cycling, both watching and doing it myself. One of the cool things is that is very data driven sport and thanks to Strava much of this becomes available to anyone, not just the elite athletes. Of course I would love to do more and get this data into Power BI. Thanks to Strava’s API’s and the new Power BI custom data connector SDK this is now possible!

I started building this connector the day the SDK became available but unfortunately got stuck a bit and I wasn’t happy with the code I wrote, I knew this could be done easier but I am a DAX guy not an M guy at the same level as DAX :). But thanks to the new amazing examples Matt has created I was able to finish the connector!

To start, the connector I wrote is fully available on GitHub: It is mostly based on the samples provided by the data connector team so I won’t go too much into the actual building of the connector itself. I added many comments to the code and point to the samples I stole them from Smile. But honestly it is pretty straightforward copy and paste from the samples when your service uses REST API’s with OAuth 2 and JSON payloads.

So let’s look at how to get it running yourself before we look at using it:

  • First make sure you have the latest version of Power BI desktop
  • Second make sure you have Visual Studio (2015 or 2017) installed so you can download and set up the Power Query SDK from here:
  • Next you need to get the code from my project from GitHub, just go to and click on download and open in Visual Studio:
  • This now opens it in Visual Studio where you can “clone” the code to your local HD
  • This opens the project where I can double click the solution
  • Now this will open the solution that we need:
  • As you might notice two files are missing, these are the files that are needed to authenticate with Strava using OAuth, a Client ID and Client Secret. In the current version of the Connector SDK this information is needed locally to be able to connect. There is an item on the road map (before it goes RTM) to move this into a cloud based solution so you can distribute connectors without having to add the client id and secret into the code itself.  But for now during the preview we need to add them locally, so I add these files for now.
  • To get the Client ID and Secret I need to create an app with Strava, so I go to to create the app. This will allow me to interact with strava information on a users behalf. I go to my profile and “API application”
    As you can see (well I deleted my Client ID and secret) but now you can get the client ID and Secret
  • Also important is to set the right redirect URL, in this case, this used in the OAuth Authentication flow:
  • I use that information to add two files to my solution called client_id and client_secret that contain just those 2 values that you can copy from the app you just created in the Strava site.
  • Now you will notice two new icons next to the files, this means these files are excluded from github so you will never accidentally publish the client id and secret when making updates to the connector (feel free to :))
    Also it is important that both these files are set to Compile so that they will be included in the build (they should be automatically but it is worth double checking)
  • Now we are ready to build the connector and load it into Power BI desktop. Just Build the solution and you should get a compiled mez file in your debug folder (it doesn’t matter if you do a release or debug build)
  • This file I copy to a folder that the Power BI desktop will look at “C:\Users\YOURUSERNAME\Documents\Power BI Desktop\Custom Connectors”
  • Next I have to make sure I turn on the Preview feature in Power BI desktop (note: this feature is no longer in preview so this is not needed anymore):
  • Now that the custom connectors are released you need to change data extension security settings to allow extensions without validation. Go to Power BI Desktop select File > Options and Settings > Options > Security. 
  • Now get the Strava connector available in Power BI dekstop.

Now that we have the connector available, let’s look at using it:

  • I now have a Strava connector in my Power BI desktop
  • When I select it I get asked to sign in:
  • Clicking sign allows me to sign in to Strava and Connect
  • After connecting it shows me the Navigator where the real magic happens:
  • Here you see 2 tables that are exposed, 1 with Activities and another with Athlete information, I select both. Clicking on them gives me a preview:
  • After pressing Load the data gets loaded into Power BI desktop. Done!
  • This now gives me a ton of data for all my tracked activities in Strava:
  • That I can now use to analyze:
  • And build a report on:

113 Replies to “Building the Power BI Strava data connector

  1. Congratz, Kasper! really happy to see you finishing that custom connector. I know that you were working on it for a long time. How much time did you spend reading the API documentation vs actually writing code on Visual Studio?

  2. Great job Kasper!
    This is really something that will be truly useful!

    But there seems to be something strange when I try to use the connector. I cant sign in to Strava from Power BI Desktop, when clicking sign in I only get a http 400 error.
    I read something in the readme file about IE issues but that shouldn’t be the case when trying to sign in from Power BI Desktop, right?
    Any idea what might be causing this?

    1. Did you make sure you set as the redirect domain in Strava? You can always run fiddler to see the actual error message.

  3. Stumbled on this when trying to see how data connectors work… I followed the steps but I get “The webpage can not be found”-error when clicking “Sign In”… Any ideas? Thnx.

      1. Ha. I had filled that one in. But it is case sensitive! so ‘’ does not work. ‘’ does work.

  4. Kasper, I built a similar report using the REST API calls to Strava’s API and mashed up with data form Peloton, this certainly makes connection to Strava easier, thanks for the post!

  5. Hi Kasper – awesome solution, just what I’ve been looking for! I’m having authentication trouble. After signing in to Strava I get the following:
    Unexpected Error.
    Exception of type ‘Microsoft.Mashup.Engine.Interface.ResourceAccessAuthorizationException’ was thrown.

    Any ideas?

  6. Hello Kasper, is it possible to parameterize this connector ? right now only for our own accounts we can use this connector, it would be great if you can expand this with parameters and in that way we can use for our friends as well.

  7. This is great, thanks so much for doing this! I have very little experience with Power BI and Visual Studio but I was able to follow this and make it work.

  8. I just noticed that I can’t schedule an automatic refresh, and I can’t even refresh from the Power BI portal. I have to refresh from Power BI desktop and then re-publish. Am I doing something wrong?

  9. Hi Kasper, nice work! One question about formatting:
    The data I get in PowerBI has some strange formatting. For example the speed is not in km/u but in a low number like 10,6 in stead of 38.2km/u.
    Is there a formula for the actual speed? Same for distance.

    I would like to compare my bikes in average speed on the same (commuter) traject.

  10. It stops working. Power BI doesn’t see your custom connector. Do you have any ideas?
    Best regards, Viktor

  11. Have Strava made a change to their API? This has been working beautifully for me since November (thanks again BTW!) but it stopped working last week.

  12. Hi Kasper,
    I’m unable to load the solution in VS2017 – getting an error while loading the Strava.mproj file.

    Please any thoughts?

    Many thanks in advance!

    1. I just tried it out and it works for me. Please make sure you get the latest version of the Power Query SDK.

  13. Same here. Additional, since I upgraded to the Version: 2.60.5169.3201 64-bit (Juli 2018) I’m unable to see custom connectors (such as Strava) in the list of data sources (Get Data). However, the preview feature is still activaited and my custom connector is still located under My Documents\Microsoft Power BI Desktop\Custom Connectors. Any idea, Kasper?

  14. Same here. Additional, I’m unable to select a custom connector (Get Data) since I’ve upgraded to Version: 2.60.5169.3201 64-bit (Juli 2018). The Strava Connector vanished from the list even though the preview feature is still active and the mez-file is still in My Documents\Microsoft Power BI Desktop\Custom Connectors. Any idea, Kasper?

  15. Kasper,

    Not sure where I’m going wrong, when I try and run the connector from Power BY desktop I get a series of script errors, ignoring these will eventually get me to a Strava login, a further series of script errors on logging in takes me to the authentication page but the authentication button is not responsive (presumably due to the script errors). I’ve tried re-compiling a couple of time but feel like I’m missing something basic!

    Any ideas?

    1. Hi Gary,

      I tried it but I don’t get these script errors. In general we have seen OAuth errors for particular versions of IE (generally when PBI desktop is running on an older version of windows), which the target site has decided to stop supporting. Might that be the case?


      1. Hi Kasper,

        I’m having the same errors as explained by Gary. I updated Power Bi to the latest version and I’m running on Windows 10 (10.0.16299). Lastly, I also updated the registry keys as explained by Ian Chivers.
        However, the authentication button remains not responsive (to authorise the app.)

        Any help?


          1. there is nothing we can do about this for now, it is a IE \ Strava problem. The team is working on updating the browser to fix the problem but no timeline yet.

  16. Hello Kasper,

    There are my very first attempts to work with Visual Studio & PowerBI. Thanks for the very clear information!
    I run into this problem: in the sheet “Strava.mproj” on the first line there is a link but this link seems not to be working anymore. Error message: “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”

    Any idea whether it’s me or the link/code?


  17. Hello,

    Earlier I had a question about an error message. I managed to solve it by installing the .NET package in Visual Studio.
    Now I have been able to have all the data in power BI. But I’m wondering, can I get all my GPX files in power BI in a similar way? I would like to make some heatmaps for example.


  18. If you get javascript errors when signing into Strava, edit the following registry keys to update the version of embedded IE control PowerBI uses:

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BEHAVIORS
    Add key PBIDesktop.exe value 0

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
    Add key PBIDesktop.exe value 11001

    1. Confirming that this approach solves the Strava login issue due to the embedded IE control that PowerBI uses. You still will see two or three javascript errors, but the authentication works. Thanks Ian!

  19. Hm, I am new to PBI and this is driving me crazy. I have a machine at work, where I have scripting issues and I dont have the permissions to edit the registry (like described in Ian’s post).
    And my machine at home does not have the folder to copy the strava.mez connector to. I only have “C:\Users\[current_user]\Microsoft\Power BI Desktop Store App”. Also the options dont have the custom connector feature preview anymore.

    Google did not help (or maybe I am unable to come up with the right search). Any idea how to get the connector into my PowerBI?

    1. Hi Volker, thanks for dropping by..
      It looks like the folder got updated, it should be: “C:\Users\YOURUSERNAME\Documents\Power BI Desktop\Custom Connectors”
      I updated the blog post. Also the connector is no longer a preview feature so you don’t need to check it anymore. (I updated the blog as well).

      All you should have to do is drop the mez file in the folder I just mentioned and it should work.


      1. Is there a method to get PowerBi to open chrome for the sign-in authentication?
        The browser window that opens gets to the authorization screen and will not progress further.

          1. Having tested this again. I uninstalled Power BI Desktop and downloaded the latest x64 version. In the latest version still pop-us up some script errors but fewer, and it does now allow authentication.
            I think I may previously have been using the x86 version of Power BI not x64.

      2. Now it works. Had to create the folder manually, since the MS Store App does not create it on installation. Thank you and happy holidays!

  20. Great work Kasper,
    The Strava connector works great and is very useful. I am having trouble creating a second connector so I can download a friend’s data from Strava. Power Bi does not recognize 2 Strava connectors. How can I create a second one they both show up as custom connectors?


    1. The only way I can think is to rename the connector to Strava2 and use both. It might work but I am not sure as PQ looks at the domain name and ties the credentials to that… Make sure the names are unique, also inside the code.

  21. Awesome Kasper! I have a working Strava connector and have created a nice Power BI analysis report based on my own Strava data with awesome visuals.
    I have 2 questions for now :

    1. Is it possible to have a url / id for each activity available, to provide / generate a link to the activity on Strava in Power BI?

    2. Is it possible to retrieve data from all Strava members of my cycling club “TC De Windmolens”, so that Power BI can be used to do some analysis for the cycling club? This would be very useful since now we have to manage manually in an Excel sheet who has been joined on a particular club ride. We could replace this by an extraction from Strava.


    1. You can extend the connector to add both easily I think. The first one can easily by extending the current data, currently that is discarded. I’ll see if I can add it.

      The 2nd one should be possible but can probably take a long time. You can get the activities for your club through this API:
      and then you can iterate over that dataset and get the activity:
      and all the riders at that activity:
      So you need 3 separate calls but should be doable as you probably don’t have hundreds of activities.

  22. Hi Kasper,

    I really like your post, found it very useful 🙂 I’m trying to run it within Power BI Service in Power BI Portal. I have already done the part described here: but I cannot refresh the dataset anyway.

    When I’m trying to refresh Strava DS I receive information that credentials are invalid (what can’t be true) and below error:
    Activity ID: 422d9a2f-c449-4c32-b555-6506c8e337a0
    Request ID: 4674eaaf-776a-e77d-a9be-18ca00807392
    Status code: 500
    Time: Sun Dec 30 2018 17:57:54 GMT+0100 (Central European Standard Time)
    Version: 13.0.7683.237
    Cluster URI:

    Have you tried / managed to do that with your code?


  23. Hi Kasper. I don’t understand the part with the client id. Where do I have to paste the client id in visual studio?

    1. you have to create a file called client_id in Visual Studio in the same folder as the PQ file and past the clientID in there.

  24. I get this error message when trying to sign in via Power BI: [Expression.Error] We couldn’t find the file ‘client_id’.

    any idea of what I could have done wrong?

    1. you have to create a file called client_id in Visual Studio in the same folder as the PQ file and past the clientID in there.

      1. I am having the same error and have created 2 files , client_id and client_secret . Each file has no file extension and just the strava data values . Is there something else required?

  25. Thanks for this guide!
    The API gives back public activities only. Is this correct? Is it possible to retrieve non public activities as well? As the authentication happens on my Strava account those should be available to the interface.


    1. I think it should work, the API doesn’t say anything on the difference between public or not but I haven’t tried this.

      1. Do you know about any setting that can be configured differently? I do only retrieve my public activities 🙁

  26. Hi Kasper,

    I used to have it all worked on my old system.
    I now have everything set-up on my new system, with the .mez file in de custom connector folder. But for some reason the connector is not showing up in the ‘Get Data’ list. Do you have any idea what’s the reason and how can I solve this?

  27. Hello Kaspar,

    I have the same issue like Gery: “Not sure where I’m going wrong, when I try and run the connector from Power BY desktop I get a series of script errors, ignoring these will eventually get me to a Strava login, a further series of script errors on logging in takes me to the authentication page but the authentication button is not responsive (presumably due to the script errors).”

    what might be the solution for that?


  28. Hi Kaspar,

    I’m having the same issues as mentioned by Li & Matthias.
    Updated to the latest version of Power BI & running on an up-to date version of Windows 10.
    Any guidance on how to resolve this?


  29. HI Kaspar,

    Great work ! Thank you.

    I’m looking into retrieving the GPX file and appending the data into a table using the same connector. Have you made any attempts on that?

    1. No GPX is a very different beast and you would have to write a binary parser.. It can be done but not by me 🙂

  30. Is there any way to enable automatic refresh on the dataset once it’s in Power BI? The Automatic Refresh tab tells me it isn’t supported on this dataset.

  31. Hi Kasper,

    I was hoping you could help as I’m having some issues getting the connector to work (not at all proficient with this kind of stuff so apologies in advance).

    When opening the solution I get thrown the following error:
    The imported project “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets” was not found

    Which I bypass by simply deleting the line that looks for it from the .mproj
    Next when trying to build I get thrown:
    No destination specified for Copy. Please supply either “DestinationFiles” or “DestinationFolder”

    Which I can once again bypass by adding some static directories on lines 116 through 118 on the .mproj

    Eventually it builds and I get a .mez file (although it has no name). Unfortunately the .mez file is not recognized by PowerBI so I’m pretty sure me messing with the code must have ruined something.

    I get the feeling I’m missing some software prerequisites? Do you have any suggestions?

    Thank you.

  32. Hi Kasper,
    not working. i get the error that i can’t connect to strava because i use a old internet Explorer (my software are all actually).
    I don’t know what i do wrong.

  33. Great post. Really helpful and after a long attemp myself this got me setup with Strava / PowerBi very quickly.

    May I ask for some more details on how you can get the gear information? I see in your snapshot you have the gear labeled correctly. In my link, all my gear is given random names.

  34. This no longer works for me. I am having the same issue as Laurens, Li & Matthias with my old mez file, and the same issue as Alex on trying to do fresh opening of the solution

  35. Just worked on this for 2 hours and it worked great at the end! One question though, would you know why the data format for speed is not km/h or miles/hour? Seem to be the number for km/h divided by a factor of about 3,6. But why is it so?

  36. Hi Kasper. I had a couple of thoughts on this but wanted to get your (and anyone elses!) opinion on the viability before I invest too much time on development!

    1) I notice under activities that we can expose the “map” object. When expanding, this gives us a polyline. I was wondering if there is a way to convert the polyline to a map, for example as an image or by calling a map api with the polyline as input. It would be cool to be able to display the map when selecting an activity.
    2) I’d really like to drill down to the individual data points for each activity (i.e. gps coordinates) so that I could plot pace vs elevation vs heart rate, etc. But this could potentially be a lot of data to call when iterating over each activity. Is the connector the right way to go about this? Or should I consider some sort of middle layer (database) to avoid refreshing all of this data every time.

    But in any case, the connector is cool and has inspired further ideas!

    1. Hi Alistair,

      1 I am not sure if that data is actually very usable. Try importing it and throw it the mapbox visual.
      2 well as long as you are not hitting the rate limit from Strava it should be ok. Refreshing might take a long time …

      hope that helps,

  37. Hello Kasper,

    I really like your solution for using Strava-data on Power BI.
    When I try to do an automatic refresh once it is on I can’t get it set up properly. I follow the steps for setting up the on-premise data gateway (personal mode) and I see strava in the connectors tab. Once I want to set up the dataset on I can setup my credentials, but when I want to schedule the refresh (planned refresh) it’s grey.
    Do you know what’s going wrong?

  38. Hi Kasper,

    I seem to get a HTTP 400 error when I try to sign in. I can’t for the life of me see where I have gone wrong.

    Any ideas?

  39. Hi Kasper, looks like Power BI Desktop after last update no longer sees your connector. Do you have any thoughts? Or is everything alright on your side and only I have this problen?
    Best regards, Viktor

  40. Hi Kasper,
    Everything is working as expected right up until I am prompted to login to
    Strava, via Power BI. (after selecting the Strava (beta) file in get data)
    Power BI takes me to the Strava logon page, however after entering my credentials, I get a HTTP 400 error stating the webpage cannot be found.
    I have tried the various fixes listed above, such as updating and removing IE, the registry key alterations and installing the newest Power BI, however no luck.
    Do you have any idea why this may be the case?

  41. Hi Kasper,

    I don’t want to stress up things, but do you have any idea when a new version of the Power BI connector for Strava will be available? I have created my own reports with it and I want refresh them so badly 🙏 Hope a new working version will be available soon.


    1. I pushed out a temporary fix that should at least get you to load the data. You have to make sure you have cleared the permissions under data source settings for Strava. After you do this you need to log in and load the data, this will work for a few hours and then you will have to do clearing step again. I need to implement token refresh logic but that is quite some work.

      1. Hi Kasper,

        I’ve downloaded the update and overwritten the files. I cliedk clear permissions and it still has the page not found issue? Do you have more ideas how to get it working?

  42. Hi Kasper.

    I’ve been looking to integrate PowerBI for two cases:
    1) Analysis of data collected in Garmin Connect, preferably including custom data written to the .fit file
    2) Live streaming of data. Either from Strava Live Beacon (if possible), or by development of new hardware that can stream the data in parallel via LTE / 5G to a cloud service connect to PowerBI.

    How far are you from a version that can run in the cloud, and which is simple to setup one time and works from there?

    1. 1 Well for the FIT file you will have to parse the format somehow. There have been folks that have written a PDF parses so that should be doable. You still would need to have a place where you can get to the file.
      2 I would imagine this would be similar to any IOT scenario. I would land it in some storage first and then load the data into Power BI or use DirectQuery based on how real time you want it.

      1. 1# is solved by you already, at least partially? How far are you from enabling PowerBI being able to either connect to Garmin Connect or e.g. Todays Plan or TrainingPeaks to get the data into PowerBI?

  43. Hi,

    When i try to open the Strava solution in Visual i get the following error.

    F:\My Documents\Strava API\Strava\Strava\Strava.mproj : error : The imported project “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets” was not found. Confirm that the expression in the Import declaration “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets” is correct, and that the file exists on disk. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.CSharp.CurrentVersion.targets

    Any ideas how to fix this?

  44. This is great thank you so much. Would you know who to get the API to pull back all the details for members of a club rather than only the individual?

    1. If there is a way I’d love to know. Just got this working again and would be great to do a club stats page. I’d been doing a manual one for our club group but took ages so I stopped

  45. Hi Kasper,

    I have this working again and wondered if you ever plan on any updates?
    Like if club rides would be available or further data such as number of KOMs etc…

    I was looking at veloview and the stats that has by connecting to ones strava


  46. which type should be the new files “client_id” and “client_secret”?
    .txt of .pq?
    and how to compile?

    thanx in advance

  47. Hi there,

    did anyone overcome the issue with page not found / bad request 400? Because of it I cannot even add the datasource (so I cannot clear permission).

    Thanks a lot for any advice.


    1. Mine seems to have stopped working this month – getting page not found too when its been working for a while now (I updated to the new method this year)

  48. Hi,

    I placed the .mez file in the folder I created: `Documents\Power BI Desktop\Custom Connectors`. I changed the setting in PowerBI Desktop to allow uncertified connectors, but PowerBI doesnt find my custom connector. How can I fix this? Is there a way in which I can point PowerBI to my .mez file?


  49. Hi!
    I compiled the connector as per instructions, (VS 2017), but when I connect I receive some IE scripts errors. If I continue the execution, then the login/authorization page shows up. Once I enter my credentials, however, I have one last error:
    Exception of type ‘Microsoft.Mashup.Engine.Interface.ResourceAccessAuthorizationException’ was thrown.

    Any clues?

          1. A few things to try:
            1. Under check the Applicaiton name does not have ‘Power BI’ in the tittle or Microsoft.

            2. Check your Auth callback domain is set to (all in lowercase and with no spaces).

            3. Check you secret and client have no spaces.

            4. Revoke access and try agian.

            I’m using visual studio 2019 and Power BI March ’21

            Also got refresh tokens working (I think) going to put a blog on my own website once I’ve tested it and will share the code and link here if that’s okay?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.