I've developed a WebApi that implements OAuth2.0 and OData.
Now I'm making a client to test what I've implemented so far. I've generated the templates for OData using the OData Client Code Generator, but how can I introduce de access token in the OData request?
Any idea how to extend the OData templates to introduce the OAuth2.0 scheme? Or a more simpler way, how do I introduce OAuth access token in every OData request?
UPDATE
static void Main(string[] args)
{
var container = new Default.Container(new Uri(baseurl));
TokenResponse accessToken = null;
try
{
accessToken = GetToken();
}
catch (Exception ex)
{
Console.WriteLine("Can't do nothing without an access token...");
return;
}
//I want to introduce in every request the following information:
//Basic autentication header with cliendId + clientSecret
//Access token
//How do I introduce them before making the call on the OData service?
foreach (var s in container.ServiceSessions)
{
string format = ";
Console.WriteLine("PKID:{0}", s.PKID);
}
}