Lau*_*n F 2 put http-status-code-404 angularjs auth0
当尝试使用 auth0 发出 PUT 请求时,我不断遇到 404“用户未找到”错误。
我正在尝试更新用户,并使用他们的文档告诉我使用的确切端点进行此 API 调用。
当从他们的文档中拨打电话时(他们有一个内置测试),我发送的正文一切正常,并且我收到了 200 成功消息。
当我尝试从我的应用程序进行相同的调用时,我不断收到 404 用户未找到错误。
但是,当我使用相同的端点user_id从我的应用程序获取时,一切正常(证明我的 cliendID 配置正确)。
为什么会失败?
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;
}
Run Code Online (Sandbox Code Playgroud)
工作 GET 请求:
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;
});
}
Run Code Online (Sandbox Code Playgroud)
更新用户的端点将使用 PATCH 调用,而不是 PUT。
https://auth0.com/docs/api/v2#!/Users/patch_users_by_id
在这种情况下返回的正确响应将是 405 Method Not Allowed,但 hapi 尚不支持此功能。请参阅https://github.com/hapijs/hapi/issues/1534。
| 归档时间: |
|
| 查看次数: |
786 次 |
| 最近记录: |