View on GitHub

nissan-connect-dotnet

πŸš—πŸ”‹ A C# .NET client library for the unofficial Nissan Connect API. This library targets vehicles produced after May 2019.

Nissan Connect Client Library

CI Release Nuget

This repository contains an unofficial C# .NET client library for the Nissan Connect API. This library is based on the great dartnissanconnect-library by @Tobiaswk.

⚠️ Supports the European NissanConnect Services API (Region.EU). Other regional APIs are not implemented or tested. This is not a client for the legacy NissanConnect EV/Carwings API.


Table of Contents

Example Program

An example program can be found here.

Set these values in the example project’s .NET user-secrets secrets.json, not in the repository:

{
  "Username": "your-mynissan-email@example.com",
  "Password": "your-mynissan-password",
  "ForceBatteryStatusRefresh": false
}

Run from the repository root:

dotnet run --project NissanConnect/NissanConnectLib.Example

Keep ForceBatteryStatusRefresh set to false for read-only access; true sends a remote battery-refresh action. The example saves tokens in token.cache; treat that file as sensitive.

Example program output:

Example program output

Nuget

Install NissanConnectLib from NuGet.

dotnet add package NissanConnectLib

Usage

Targets .NET 8; .NET 9 and .NET 10 applications can also consume the library. LogIn uses MyNISSAN OneID authorization-code authentication with PKCE, then exchanges the identity token for Kamereon API tokens.

Pass ILogger<NissanConnectClient> via new NissanConnectClient(logger: logger) or dependency injection; logging is optional. Dispose manually created clients when finished. The library does not log credentials, tokens, or vehicle IDs.

Set AccessToken to restore cached authentication and use AccessTokenRefreshed to save renewed tokens. Automatic full-login fallback requires credentials from a successful LogIn; assigning a different token clears remembered credentials. LogOut clears local authentication only.

GetCars exposes Car.Services and the filtered Car.ActivatedServices. CarService.Feature maps known IDs to CarServiceFeature; unknown IDs remain in CarService.Id. For example, with NissanConnectLib.Enums imported:

bool canStartCharging = car.ActivatedServices
    .Any(service => service.Feature == CarServiceFeature.ChargingStart);

Activated services are advertised capabilities, not guarantees that commands work. They do not add controls to this library.

Upgrade Notes

The public login and vehicle method signatures are retained. Legacy ForgeRock response/callback models and ConfigurationKey.ClientSecret/Realm are removed; code referencing them must be updated. ConfigurationKey numeric values also changed.

Publish Nuget Package

Create a new GitHub Release with a tag to trigger the Nuget Release-action.

Disclaimer

This library is not endorsed by, directly affiliated with, maintained, authorized, or sponsored by Nissan Motor Corporation. All product and company names are the registered trademarks of their original owners. The use of any trade name or trademark is for identification and reference purposes only and does not imply any association with the trademark holder of their product brand.