Install-Package com.strava.api -Version 4.0.1
dotnet add package com.strava.api --version 4.0.1
<PackageReference Include="com.strava.api" Version="4.0.1" />
paket add com.strava.api --version 4.0.1
#r "nuget: com.strava.api, 4.0.1"
// Install com.strava.api as a Cake Addin #addin nuget:?package=com.strava.api&version=4.0.1 // Install com.strava.api as a Cake Tool #tool nuget:?package=com.strava.api&version=4.0.1
Important Notes (Read me first!)
This project was forked from the timheuer repo, which in turn was forked from the original by sascha-simon, neither of which have been updated in a long time. It is therefore very possible that various aspects of the project don't work as originally intended, or don't work full stop, due to changes made by Strava in their API.
Current version: 4.0.1 (June 2021)
Hopefully this small framework makes using the Strava API a little bit easier! Please keep in mind that this framework is in a pretty early stage and things are about to change. Kudos to Strava for letting people use data uploaded to Strava! Strava.NET uses the great Json.NET library from James Newton-King - such a great piece of code.
Getting an access token from Strava
You can get an access token from Strava by using one of the following methods:
- StaticAuthentication You can use this method if you already have an access token. You can either use the WebAuthentication class to get a access token from Strava or you can use your token, that you got when you registered your application.
StaticAuthentication auth = new StaticAuthentication("<insert token here>");
- WebAuthentication This procedure should be used, if you want to authorize your application for the first time. When an object is created and the GetTokenAsync() method is invoked, a browser window will open and you have to authorize the apllication. Once the button is clicked, Strava invokes a callback function. When you create a WebAuthentication object, a web server is started locally on your computer. Once the button is clicked, Strava invokes a callback function which is received by the callback server. You now have a working access token created specifically for your application. You can store this access token in a file on your hard disk, so you don't have to open a browser window every time. You should use some sort of cryptographic algorithm, to obfuscate the access token.
Upon the next start of the program, you can then load the token from your hard disk and use the StaticAuthentication method described above.
The date and time that the token expires will also be saved, so it is possible to check this and only obtain a new token when this is actually required.
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.