How to use api without global token authentication
caco0516 opened this issue · comments
`
using System;
using System.Diagnostics;
using Strava.NET.Api;
using Strava.NET.Client;
using Strava.NET.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure OAuth2 access token for authorization: strava_oauth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ActivitiesApi();
var name = name_example; // string | The name of the activity.
var type = type_example; // string | Type of activity. For example - Run, Ride etc.
var startDateLocal = startDateLocal_example; // string | ISO 8601 formatted date time.
var elapsedTime = 56; // int? | In seconds.
var description = description_example; // string | Description of the activity. (optional)
var distance = 3.4; // float? | In meters. (optional)
var trainer = 56; // int? | Set to 1 to mark as a trainer activity. (optional)
var photoIds = photoIds_example; // string | List of native photo ids to attach to the activity. (optional)
var commute = 56; // int? | Set to 1 to mark as commute. (optional)
try
{
// Create an Activity
DetailedActivity result = apiInstance.CreateActivity(name, type, startDateLocal, elapsedTime, description, distance, trainer, photoIds, commute);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ActivitiesApi.CreateActivity: " + e.Message );
}
}
}
}
`
// Configure OAuth2 access token for authorization: strava_oauth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
This line make access token public and static but I need to use a different access token when calling an API. I creating a web app so every time a user ask for his activities a need to call api but without using a static access token.