Was this helpful?

See all application entities

You can set or update a user password by using cURL or one of the SDKs.

If you're an Admin, use the POST method to initially set a user's password or reset the user's existing password. If you're a user, use the PUT method to reset your password.

To protect password visibility, passwords are stored in an API Services credentials vault. Passwords must be at least 5 characters long and can include the characters a-z, 0-9, @, #, $, %, ^, and &.

Request URI

PUT /<org_id>/<app_id>/users/<user>/password <request body>

Parameters

Parameter Description
uuid | org _id Organization UUID or organization name
uuid | app_id Application UUID or application name
user User email or username
request body

New and old passwords:

{"newpassword":"foo9876a","oldpassword":"bar1234b"}

Note: If you are accessing an endpoint with application-level access (rather than application user-level access or anonymous access), it is not necessary to provide an old password. See Authenticating users and application clients for further information about access levels.

Example - Request

curl -X PUT "https://api.usergrid.com/my-org/my-app/users/john.doe/password" -d '{"newpassword":"foo9876a","oldpassword":"bar1234b"}'

Example - Response

{
  "action": "set user password",
  "timestamp": 1355185897894,
  "duration": 47
}

The example assumes use of the JavaScript (HTML5) SDK.

var options = {
    method:'PUT',
    endpoint:'users/john.doe/password',
    body:{ 
    	oldpassword: 'myoldpassword',
    	newpassword:'foo9876a' 
    }
};
client.request(options, function (err, data) {
    if (err) {
        //error — PUT failed
    } else {
        //success — data will contain raw results from API call       
    }
});

The example assumes use of the Ruby SDK.

app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
john_doe = app['users/john.doe/password'].entity
john_doe.newpassword = 'foo9876a'
john_doe.save

The example assumes use of the Node.js module.

var options = {
    method:'PUT',
    endpoint:'users/john.doe/password',
    body:{ newpassword:'foo9876a' }
};
client.request(options, function (err, data) {
    if (err) {
        //error — PUT failed
    } else {
        //success — data will contain raw results from API call       
    }
});

 

コメントを追加

Provide your email address if you wish to be contacted offline about your comment.
We will not display your email address as part of your comment.

We'd love your feedback and perspective! Please be as specific as possible.
Type the characters you see in this picture. (verify using audio)

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.