I am trying to build Single Sign On functionality into my C++ Store app using Live SDK and Azure Mobile Services (similar to what is described for .NET apps here).
I am using Azure Mobile C++ Library and the live_connect.h wrapper. Below is what my code looks like:
void MapQuizVC12::StartPage::LoginIntoLive()
{
LiveClient->login(L"wl.basic wl.signin").then([this](bool isLoggedIn)
{
LiveClient->get(L"me").then([this](json::value v)
{
auto token = json::value::object();
token[L"authenticationToken"] = json::value::string(LiveClient->authentication_token());
AzureMobileHelper::mapquizMobileService::GetClient()
.login(azure::mobile::authentication_provider::microsoft, token)
.then([](task<azure::mobile::user> user)
{
try
{
user.wait();
}
catch (std::exception e)
{
}
}, concurrency::task_continuation_context::use_current());
}, concurrency::task_continuation_context::use_current());
}, concurrency::task_continuation_context::use_current());
}
The Live authentication seems to work fine but when I use the auth token to login to Zumo, I get the following exception in the catch block above:
After some playing around. I figured that the Live authToken being returned by the C# SDK is different from the one that is being returned by the C++ API. Azure Mobile service actually expects what is returned by the C# SDK. I have posted about this problem here.
What am I doing wrong?