Method: Parse::Query#session_token

Defined in:
lib/parse/query.rb

#session_tokenString

Note:

Using a session_token automatically disables sending the master key in the request.

Set the session token to send with this API request. A session token is tied to a logged in User. When sending a session_token in the request, this performs the query on behalf of the user (with their allowed privileges). Using the short hand (inline) form, you can also pass an authenticated User instance or a Session instance.

Examples:

# perform this query as user represented by session_token
query = Parse::Query.new("_User", :name => "Bob")
query.session_token = "r:XyX123..."

# or inline
query = Parse::Query.new("_User", :name => "Bob", :session => "r:XyX123...")

# or with a logged in user object
user = Parse::User.('user','pass') # => logged in user'
user.session_token # => "r:XyZ1234...."
query = Parse::Query.new("_User", :name => "Bob", :session => user)

Returns:

  • (String)

    the session token to send with this API request.

Raises:

  • ArgumentError if a non-nil value is passed that doesn’t provide a session token string.



152
# File 'lib/parse/query.rb', line 152

attr_accessor :table, :client, :key, :cache, :use_master_key, :session_token