Principales respuestas
Live Connect single sign-on for both W8 and WP8

Pregunta
-
How should I proceed with steps 4 and 5 (in this tutorial: http://www.windowsazure.com/en-us/develop/mobile/tutorials/single-sign-on-wp8/) if I already have a mobile service set up for a Windows 8 app and I want to use the same data? In step 5, I wouldn't be able to mark it as a mobile app because the mobile service needs to support both a W8 and WP8 app.lunes, 3 de diciembre de 2012 5:16
Respuestas
-
Thanks to Xinyang for his help!
The key was to mark the app as a mobile app, replace ClientId in the example code above with my app's ClientId (not return url), and to replace "Client" with "App.MobileService" for the last LoginAsync method in the example code above.
- Marcado como respuesta Josh Twist (MSFT) martes, 11 de diciembre de 2012 5:20
viernes, 7 de diciembre de 2012 19:04
Todas las respuestas
-
You can mark it as a mobile app and it will work on both the Windows 8 and Windows Phone 8. Here's some example code for both of the platforms.
Windows Phone
var authClient = new LiveAuthClient("clientid"); reqs = new[] { "wl.signin", "wl.basic", "wl.offline_access" }; var init = await authClient.InitializeAsync(reqs); var session = authClient.Session; if (init.Status != LiveConnectSessionStatus.Connected) { this.Status.Text = "need login"; var logStatus = await authClient.LoginAsync(reqs); if (logStatus.Status == LiveConnectSessionStatus.Connected) { this.Status.Text = "login ok"; session = logStatus.Session; } } if (init.Status == LiveConnectSessionStatus.Connected) this.Status.Text = "login ok"; var user = await Client.LoginAsync(session.AuthenticationToken); Status.Text = "Connected to mobile service as " + user.UserId;
Windows 8
var authClient = new LiveAuthClient("https://myservice.azure-mobile.net/"); reqs = new[] { "wl.signin", "wl.basic", "wl.offline_access" }; var init = await authClient.InitializeAsync(reqs); var session = authClient.Session; if (init.Status != LiveConnectSessionStatus.Connected) { this.Status.Text = "need login"; var logStatus = await authClient.LoginAsync(reqs); if (logStatus.Status == LiveConnectSessionStatus.Connected) { this.Status.Text = "login ok"; session = logStatus.Session; } } if (init.Status == LiveConnectSessionStatus.Connected) this.Status.Text = "login ok"; var user = await Client.LoginAsync(session.AuthenticationToken); Status.Text = "Connected to mobile service as " + user.UserId;
The code samples are such that the app will remember the user and won't display the login page every time.- Editado MikaelKoskinen martes, 4 de diciembre de 2012 9:27
martes, 4 de diciembre de 2012 9:27 -
Thank you for your response, but I'm still getting the same error message I've been getting:
"We're unable to complete your request. Windows Live ID is experiencing technical difficulties. Please try again later."
martes, 4 de diciembre de 2012 16:34 -
Did you get this message form https://manage.dev.live.com/? If so, check to see if you have the correct return url.
If you get this from wp8 live SDK sign in code, make sure your clientID is correctly configured.
Xinyang
martes, 4 de diciembre de 2012 21:41 -
The return url is correct.
What do you mean by "your clientID is correctly configured"?
- Propuesto como respuesta MingshuDong lunes, 17 de diciembre de 2012 5:37
- Votado como útil MingshuDong lunes, 17 de diciembre de 2012 5:37
viernes, 7 de diciembre de 2012 7:01 -
When you use Live SDK in wp8 with live SDK, did you use the following sing in button configuration? Did you change the ClientId to match what you have in your https://manage.dev.live.com/ 's application?
<my:SignInButton
Name="btnSignin"
ClientId="xxxxxxxxxxxxxxxxxx"
Scopes="wl.basic"
Branding="Windows"
TextType="SignIn"
SessionChanged="btnSignin_SessionChanged"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Grid.Column="1"
Margin="113,448,0,0"
Grid.Row="4"
Grid.RowSpan="2" />viernes, 7 de diciembre de 2012 17:59 -
Thanks to Xinyang for his help!
The key was to mark the app as a mobile app, replace ClientId in the example code above with my app's ClientId (not return url), and to replace "Client" with "App.MobileService" for the last LoginAsync method in the example code above.
- Marcado como respuesta Josh Twist (MSFT) martes, 11 de diciembre de 2012 5:20
viernes, 7 de diciembre de 2012 19:04