Exporteren (0) Afdrukken
Alles uitvouwen
EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

Client-directed login operation

Updated: July 13, 2013

Requests an authentication token from Microsoft Azure Mobile Services by using an identity token already obtained from an identity provider. The returned token is used to make subsequent authenticated requests to the mobile service. The token presented to Mobile Services for authentication must be obtained by the client independent of Mobile Services, usually by using the providers SDK, such as the Facebook SDK for iOS. Use client-initiated authentication when your app obtains an identity token to enable single sign-on or get additional user information using the provider SDK. If your app doesn’t need to interact directly with the identity provider, you can instead use the Service-directed login operation.

The request may be specified as follows. Replace <service_name> with your mobile service name and <provider> with the identity provider.

 

HTTP Verb Request URI HTTP Version

POST

https://<service_name>.azure-mobile.net/login/<provider>

HTTP/1.1

The identity provider used for authentication can be one of the following:

 

Provider value Description JavaScript Backend Support .Net Backend Support

facebook

Login by presenting a token obtained from Facebook.

Yes

No

google

Login by presenting a token obtained from Google.

No

No

microsoftaccount

Login by presenting a token obtained from Live Connect.

Yes

No

twitter

Login by presenting a token obtained from Twitter.

No

No

windowsazureactivedirectory

Login by presenting a token obtained from an Azure Active Directory.

No

Yes

noteNote
You must first configure the identity provider used for authentication with your mobile service. For more information, see Configure identity.

The following table describes the request headers.

 

Request Header Required  

Accept

No

Set this header to application/json.

Content-Length

Yes

The length of the request body.

Content-Type

No

Set this header to application/json.

The request body contains a single object, expressed in JavaScript Object Notation (JSON). The object contains a single field, which depends on the identity provider:

 

Provider JSON object

Microsoft Account

{
    "authenticationToken" : "<authentication_token_value>"
}

Facebook

Google

Azure Active Directory

{
    "access_token" : "<access_token_value>"
}

The response includes an HTTP status code, a set of response headers, and a response body.

A successfully operation returns status code 200 (OK).

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

 

Response Header Description

Content-Length

The length of the response body.

Content-Type

Header set to application/json.

x-zumo-version

Indicates which version of the runtime executed the request.

The request body contains a single JSON object with two properties. The following table describes the properties of the JSON object in the response body.

 

Property Name Description

user

JSON object that contains the userId value assigned by Mobile Services to the authenticated user.

authenticationToken

A JSON web token (JWT), which is the authentication token returned by Mobile Services based on positive authentication. This token is provided in subsequent authenticated requests to the mobile service, and can be cached until expired.

The response to a request to use a Microsoft Account token contains the following JSON payload:

{
    "user": {
        "userId" : "MicrosoftAccount: <user_id>"
    },
    "authenticationToken" : "<jwt_token>" 
}

Weergeven:
© 2014 Microsoft