Thank you, guys! Now it works.
auto auth = ref new OnlineIdAuthenticator ();
auto request = ref new OnlineIdServiceTicketRequest ("wl.signin wl.basic wl.skydrive_update", "DELEGATION");
auto request_vec = ref new Vector <OnlineIdServiceTicketRequest ^> ();
request_vec->Append (request);
task <UserIdentity ^> authenticationTask (auth->AuthenticateUserAsync (request_vec, CredentialPromptType::RetypeCredentials));
authenticationTask.then ([] (task <UserIdentity ^> idtask)
{
try
{
auto ident = idtask.get ();
auto ticket = ident->Tickets->GetAt (0);
token = std::wstring (ticket->Value->Data ());
}
catch (const concurrency::task_canceled &)
{
int _break_point_here = 0;
}
catch (const std::exception &)
{
int _break_point_here = 0;
}
catch (Platform::Exception ^ex)
{
std::wstring s = std::wstring (ex->Message->Data ());
int _break_point_here = 0;
}
});
I am very appreciated for your help!