I keep hitting a 404 "user not found" error when trying to make a PUT request with auth0.
I'm trying to update a user and making this API call with the exact endpoint their docs told me to use.
When making the call from their docs (they have a built in test), everything works fine with the body I send and I receive a 200 success message.
When I try making the same call from my app, I keep getting a 404 user not found error.
However, when I use the same endpoint with the same user_id
to GET from my app, everything works fine (proving my cliendID is configured correctly).
Why is this failing?
var updateAuthUser = function(){
var request = {
"user_metadata": {
"springboardID": 100055
}
}
var update = $http.put('https://app36591925.auth0.com/api/v2/users/auth0%7C5606b3c4b0c70b49698612fc', request);
update.then(function(response) {
console.log("update success", response);
}, function(response) {
console.log("update failure", response);
});
return update;
}
Working GET request:
var getAuthUser = function(){
$http.get('https://app36591925.auth0.com/api/v2/users/auth0|5606b3c4b0c70b49698612fc')
.then(function(response){
console.log("response", response);
var deferred = $q.defer();
deferred.resolve(response);
return deferred.promise;
});
}
The endpoint to update a user is to be called with PATCH, not PUT.
https://auth0.com/docs/api/v2#!/Users/patch_users_by_id
The correct response to return in this case would be 405 Method Not Allowed, but hapi does not yet support this. See https://github.com/hapijs/hapi/issues/1534.