1
votes

I'm building my WP8 app in combination with Azure Mobile Services. I use Twitter as authentication method for Azure. So I use the following code to log in:

user = await Client.LoginAsync(MobileServiceAuthenticationProvider.Twitter);

Where Client is my MobileServiceClient.

When executed, this triggers a WebBrowser to open and let the user log in, etc. After that, the 'user' object is succesfully filled. (.UserId).

However, I want this login only to happen once. Because the next time the user opens the app, he needs to log in again.

Suggestions mentioned in an other thread (here) suggest I build the user object myself with the previously obtained data like this:

var mobileServiceClient = new MobileServiceClient("<your-app-url>", "<your-app-key>");
mobileServiceClient.CurrentUser = new MobileServiceUser("Foo:123456789");
mobileServiceClient.CurrentUser.MobileServiceAuthenticationToken = "<your-users-JWT>";

But this isn't possible in WP8... The MobileServiceUser hasn't got a constructor with 1 parameter, of when an empty user constructed, the UserId property is read-only.. Also the MobileServiceAuthenticationToken isn't available. So this method won't work.

My authenticaton with Twitter itself works, I obtained the accessToken and accessTokenSecret with the user.getIdentities, so to be clear, the problem is the user authentication with my azure mobile service..

Any other suggestions? Thanks in advance!

1
Did you solve this Problem?JTIM

1 Answers

0
votes

Use the new NuGet package - http://nuget.org/packages/windowsazure.mobileservices

Install-Package WindowsAzure.MobileServices -Pre

Note: at the time of posting this NuGet is in pre release.