"Failed to parse UUID" 尝试通过 TrueVault 登录时出现错误消息 api

"Failed to parse UUID" error message on attempting to login via TrueVault api

尝试使用 angular js 通过 truvault api 登录时,我收到此错误消息:无法解析 UUID。我将用户名、密码和 account_id 作为参数传递。我成功使用 curl 命令并获得成功响应。

api 授权文档中没有描述 400 错误。我不确定这个 UUID 是否链接到 schema_id。有谁(truevault 的家伙!!)知道我做错了什么吗?

我就此联系了 truevault 支持。 Dan 帮助我度过难关。

我将 username/password/account_id 作为 url 字符串查询参数传递。我不得不对代码进行两处更改: 1.将以上作为表单数据参数传递 2. 将 angular-post-fix.js 添加到我的项目中。 (注意:我没有添加 link,因为有些编辑不允许 post 和 link 到其他地方。这在过去发生过!)

使用Node.js时,querystringAPI非常有用。只需将 object 传递给 querystring.stringify() 函数,结果输出就可以发送到 TrueVault 进行登录。

此外,我发现添加 header 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' 可能是必要的(这是 Angular post-fix 库所做的事情之一)。

@orthodoc 是对的,但是如何实际构建请求有点棘手。假设我们正在使用 fetch with formData 参数,我想添加一个成功请求的示例:

...
var formData = new FormData();
formData.append('username', username);
formData.append('password', password);
formData.append('account_id', accountId);

return fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
  },
  body: formData
});
...