Exportera (0) Skriv ut
Visa allt
EN
Det här innehållet finns inte tillgängligt på ditt språk men här finns den engelska versionen,

Service-directed login operation

Updated: July 13, 2013

Requests that Microsoft Azure Mobile Services initiate authentication using a specific identity provider. The returned token is used to make subsequent authenticated requests to the mobile service. When using service-directed login, Mobile Services initiates an OAuth flow that enables your client to login to Mobile Services by using the requested identity provider. If you have already obtained a token from an identity provider, you can instead use the Client-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

GET

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

Requests a login by using Facebook as the identity provider.

Yes

Yes

google

Requests a login by using Google as the identity provider.

Yes

Yes

microsoftaccount

Requests a login by using Live Connect as the identity provider.

Yes

Yes

twitter

Requests a login by using Twitter as the identity provider.

Yes

Yes

windowsazureactivedirectory

Requests a login by using Azure Active Directory as the identity provider.

Yes

Yes

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

This request starts an OAuth flow initiated by Mobile Services.

None in the initial request.

No Mobile Services-specific request headers are required. The request may also include additional standard HTTP headers.

The response includes an HTTP status code, a set of response headers, and a response body. The exact response depends on the state in the OAuth flow.

An operation ultimately returns one of the following status codes:

 

Status code Description

200 (OK)

Login has completed successfully. When login has completed successfully, you are returned to a URL that contains the authentication token as a JSON web token (JWT), with the following format:

https://<service_name>.azure-mobile.net/login/done#token=<jwt_token>

401 (Unauthorized)

This status code is returned when an authentication failure occurs. This can occur when the identity provider has not been registered with Mobile Services. For more information, see Configure identity. Check the error message in the response body for details.

noteNote
During the OAuth process, the OAuth state can be determined from the <oauth_state> value in the URL, which has the following format:

https://<service_name>.azure-mobile.net/login/<provider>#state=<oauth_state>

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

Location

The URL of the identity provider to which the login request was redirected. This page is displayed to allow users to login by using the specific provider.

Set-Cookie

The wams_state attribute contains the state value that is used in subsequent requests to identify the OAuth session.

x-zumo-version

Indicates which version of the runtime executed the request.

(Optional) When the OAuth process is complete, a JSON object might be returned that contains fields for the response status (code) and the response message (error), as follows:

{
    "code" : <http_code>,
    "error" : "<message>"
}

.

Visa:
© 2014 Microsoft