Compartilhar via


user object

 

Represents a Microsoft Azure Mobile Services user.

Members

This object contains the following members:

Functions

getIdentities

Syntax

Return Type

Description

user.getIdentities(options)

undefined

Asynchronously accesses identity information for the logged-in user. This function takes an options parameter, which is used to supply a success and error callback functions, as follows:

{
    success: function(identities) {

    },
    error: function(e) {

    }
}

After a user has been authenticated, Mobile Services passes to the success function an identities object, which contains the following fields:

{
    "providerName": {
      "userId": "ProviderName:user_id_value",
      "accessToken": "access_token_value"
    }
}

An error object is supplied to the error callback function when an error occurs. The error callback function is optional.

Note

Mobile Services is able to automatically retrieve additional user information from your identity provider. For more information about how to enable and use this preview functionality, see the Enhanced users feature blog post.

user.getIdentities()

object

System_CAPS_importantImportant

The synchronous version of getIdentities has been deprecated. Please use the asynchronous version that takes an options parameter of success and error callback functions.

Synchronously requests a JavaScript Object Notation (JSON) object that contains identity information, in the following format:

{ "providerName": {
    "userId": "user_id_value",
    "accessToken": "access_token_value",
    "accessTokenSecret": "access_token_secret_value"
    }
}

The access_token_secret_value may not be available for all identity providers.

Properties

Property name

Type

Description

accessTokens

object

A JavaScript Object Notation (JSON) object that contains the access token, in the following format:

{ providerName: "access_token_value" }

level

string

The level of authentication, which can be one of the following:

  • admin: the master key was included in the request.

  • anonymous: a valid authentication token was not provided in the request.

  • authenticated: a valid authentication token was provided in the request.

userId

string

The user ID of an authenticated user. When a user is not authenticated, this property returns undefined.

Remarks

Scripts registered to table operations are always passed an instance of the user object, regardless of whether the operation is authenticated.

In a custom API, the user object is accessed from the request object supplied to the function.

See Also

Mobile Services JavaScript (Node.js) backend library