https://github.com/sealbro/dotnet.garmin.connect
Unofficial garmin connect client
https://github.com/sealbro/dotnet.garmin.connect
client dotnet dotnet-core garmin
Last synced: 6 months ago
JSON representation
Unofficial garmin connect client
- Host: GitHub
- URL: https://github.com/sealbro/dotnet.garmin.connect
- Owner: sealbro
- License: mit
- Created: 2021-11-07T19:02:10.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-26T06:26:40.000Z (6 months ago)
- Last Synced: 2025-03-30T22:12:00.410Z (6 months ago)
- Topics: client, dotnet, dotnet-core, garmin
- Language: C#
- Homepage:
- Size: 315 KB
- Stars: 25
- Watchers: 5
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Garmin.Connect
Unofficial dotnet garmin connect client
[](https://github.com/pachman/dotnet.garmin.connect/actions/workflows/build.yml)
[](https://www.nuget.org/packages/Unofficial.Garmin.Connect/)
[](https://www.nuget.org/packages/Unofficial.Garmin.Connect/)## About
This package allows you to request your device, activity and health data from your Garmin Connect account.
**WARNING!** Use the library only for personal automation without too many accounts. For other needs [request access](https://developer.garmin.com/gc-developer-program/overview/) to the developer program.
## Installation
```bash
dotnet add package Unofficial.Garmin.Connect
```## Using
### Default authentication
```dotnet
var login = "";
var password = "";
var authParameters = new BasicAuthParameters(login, password);var client = new GarminConnectClient(new GarminConnectContext(new HttpClient(), authParameters));
```### Authentication with MFA (multi-factor auth) codes
```dotnet
var login = "";
var password = "";
var authParameters = new BasicAuthParameters(login, password);var mfaCode = new StaticMfaCode();
var client = new GarminConnectClient(new GarminConnectContext(new HttpClient(), authParameters, mfaCode));
```Example `IMfaCodeProvider` implementation
```dotnet
public class StaticMfaCode: IMfaCodeProvider
{
public Task GetMfaCodeAsync()
{
// 1. static code
var code = "123456";
// 2. wait input code from console
// var code = Console.ReadLine().Trim();
// 3. any other approach how to wait and get the code from the user
// like read from file, variable, form input, etc.
return Task.FromResult(code);
}
}
```## Build and publish
- build `./pack.sh`
- pack `./publish.sh`## Tests
- set environment variables `GARMIN_LOGIN` and `GARMIN_PASSWORD`
- JetBrains Rider `File | Settings | Build, Execution, Deployment | Unit Testing | Test Runner`## Thanks
- The first vision from [cyberjunky/python-garminconnect](https://github.com/cyberjunky/python-garminconnect)
- Icons made by [Freepik](https://www.freepik.com) from [www.flaticon.com](https://www.flaticon.com/)
- Converter JSON to C# [app.quicktype.io](https://app.quicktype.io/)
- and [Garmin](https://connect.garmin.com) for the best devices