Was deze pagina nuttig?
Uw feedback over deze inhoud is belangrijk. Laat ons weten wat u denkt.
Aanvullende feedback?
1500 tekens resterend
Exporteren (0) Afdrukken
Alles uitvouwen
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

MobileServiceClient.login function

Updated: June 20, 2013

Logs a user into a mobile service by using the specified identity provider.

mobileServiceClient.login(provider, token);

Type: string

The name of the identity provider, which instructs Mobile Services which provider to use for authentication. The following values are supported:


Provider value Description


Microsoft Account login.


Facebook login


Twitter login


Google login

Type: string

Optional JSON representation of an authentication token, which can be supplied when the client has already obtained a token from the identity provider.

Type: boolean

Indicates whether to use single sign-on when logging in. Only supported in a Windows Store app.

Type: Promise object that returns a user object when it completes.

Call the done method on the returned Promise object to access the returned user and handle any errors.

The following code authenticates the user by using a Facebook login, and then accesses the returned user ID value.

mobileService.login("facebook").done(function (results) {
    var userId = results.userId;
    // Do something with the user ID.

When you set the useSingleSignOn value to true, Mobile Services will attempt to login using credentials cached on the client. To be able to use this functionality, you must have also registered your Windows Store app package information with Mobile Services. For information on how to register your app package, see the tutorial Get started with push notifications in Mobile Services.






© 2015 Microsoft