Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving Refresh Token from Windows Live SDK in Universal Windows App

I'm developing an universal windows app (Windows 10) where I have a "Two-Layered" App: On IoT-Devices (e.g. Raspberry Pi 2) it just displays content, but on all other Devices (PC, Notebook, Smartphone, etc.) you have something like an controller for the displayed data.

One of the features I want to realize is the Windows Live Login in the Controller Part to get Calendar Information in the Display-IoT-Part. For that I give users the opportunity to login with Windows Live as shown below:

LiveAuthClient auth = new LiveAuthClient();
LiveLoginResult loginResult = await auth.LoginAsync(new string[] { "wl.signin", "wl.calendars", "wl.offline_access" });
if (loginResult.Status == LiveConnectSessionStatus.Connected)
{
    //Save the AccessToken from loginResult.Session.AccessToken
    TokenHandler.Save(loginResult.Session.AccessToken); //AccessToken is quite accessable right here
    //But as far as I know I should save the RefreshToken, but the Session has no field for it
}

So my proplem is, that I don't get a field from the LiveConnectSession where the RefreshToken could be stored, but all articles I read are telling, that I just need to add wl.offline_access to the scopes for receiving an RefreshToken.

I'm not very familiar with OAuth2.0 and SDKs / APIs are building on OAuth, so does someone knows anything, what I'm doing wrong or how I have to handle it?

I'm really thankful for all well meant and helpful answers!

PS: I'm using the Live SDK 5.6 and not the new OneDrive API, because it has no access to Calendar Information

like image 850
Tobias Raphael Dieckmann Avatar asked Sep 29 '15 15:09

Tobias Raphael Dieckmann


Video Answer


1 Answers

wl.offline_access

in this case it's talking about user authorization and allowing the app to have the user's authorization to work when they're not present (when the user is offline, instead of the computer/device).
This doesnt mean the app would login user when system is offline but would request user to allow app to work when user isn't present.
Even I had used the Live SDK to fetch user data in one of my earlier projects and but for calendar had to use Office365. Now you can even make use of Outlook API Though we do get Access Token using loginResult.Session.AccessToken but I dont think a refreshToken is generated for WinRT app.

like image 194
Jerin Avatar answered Sep 18 '22 00:09

Jerin