Authentication
To authenticate with the API, use one of the following methods to log in and save the JWT token:
- C#
- Curl
- PowerShell
using Microsoft.Extensions.Logging;
using System.Net.Http;
using eConnect.EventsBridge.Sdk;
// Nuget Package: https://www.nuget.org/packages/eConnect.EventsBridgeSdk
// Create a logger factory
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
// Create an HTTP client
var httpClient = new HttpClient();
// Initialize the SDK with authentication
var sdk = await eConnectEventsBridgeSdk.GetSdk(
loggerFactory,
"https://your-domain.com/eventsbridge",
httpClient,
"your_username",
"your_password"
);
// The SDK is now authenticated and ready for use
# Define variables
API_URL="https://your-domain.com/eventsbridge"
USERNAME="your_username"
PASSWORD="your_password"
TOKEN=$(curl -X POST "$API_URL/api/Auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "'$USERNAME'", "password": "'$PASSWORD'"}' | jq -r '.token')
echo $TOKEN
# Define variables
$API_URL = "https://your-domain.com/eventsbridge"
$USERNAME = "your_username"
$PASSWORD = "your_password"
$body = @{
username = $USERNAME
password = $PASSWORD
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri "$API_URL/api/Auth/login" -Method Post -Body $body -ContentType "application/json"
$token = $response.token
# Now $token can be used in subsequent requests
Replace the placeholders (your-api-url
, your_username
, your_password
) with your actual API details.