Skip to content

Autoryzacja

PiotrFerenc edited this page Jan 6, 2022 · 1 revision
var clientId = "Client ID z zarejestrowanej aplikacji: https://apps.developer.allegro.pl/";
var clientSecret = "Client Secret z zarejestrowanej aplikacji: https://apps.developer.allegro.pl/";
var base64Key = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{clientId}:{clientSecret}"));

var allegroApi = new AllegroRestClient();

var data = await allegroApi.Query(new GetVerificationUriCompleteCommand()
{
    AuthKey = base64Key,
    ClientId = clientId
});

//open browser with data.url

var result = await allegroApi.Query(new CheckAccountConfirmationCommand()
{
    Authorization = base64Key,
    DeviceCodeId = data.deviceCode
});

var authorization = result.deviceAuthToken.access_token;