Ho sviluppato un WebApi che implementa OAuth2.0 e OData.Come integrare OAuth2.0 con OData Client Code Generator?
Ora sto facendo un client per testare ciò che ho implementato finora. Ho generato i modelli per OData usando il generatore di codice client OData, ma come posso introdurre il token di accesso nella richiesta OData?
Qualche idea su come estendere i modelli OData per introdurre lo schema OAuth2.0? O in un modo più semplice, come posso introdurre il token di accesso OAuth in ogni richiesta OData?
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);
}
}
Si prega di aggiungere un po' di codice e essere specifico circa la fine risultati desiderati. Mi piace voler accedere ad un utente su abc.com. O vuoi avere le informazioni condivise pubblicamente dell'utente. – Ammar
Ho introdotto un semplice codice di esempio e ulteriori informazioni su ciò che voglio ottenere. È più chiaro ora? –
Stai cercando di avere clientId e segreto da Facebook? – Ammar