Skip to content

Authentication

sonvister edited this page Nov 12, 2017 · 8 revisions

Authentication

Create a user authentication instance (IBinanceApiUser) with your Binance account API Key and Secret (optional). The interface and implementation is IDisposable due to an internal HMAC used for signing requests (subsequently, the API Secret is not stored as a property in the BinanceApiUser class privately or otherwise).

var user = new BinanceApiUser("<Your API Key>", "<your API Secret>");

NOTE: User authentication is method injected -- only where required -- so a single Binance API instance (with a single HttpClient) is capable of supporting multiple Binance users.

Console Application Prerequisites

When using the BinanceConsoleApp sample you may see this message when accessing non-public API methods:

To access some Binance endpoint features, your API Key and Secret may be required. You can either modify the 'ApiKey' and 'ApiSecret' configuration values in appsettings.json. Or use the following commands to configure the .NET user secrets for the project:
        dotnet user-secrets set BinanceApiKey <your api key>
        dotnet user-secrets set BinanceApiSecret <your api secret>
For more information: https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets