Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 与postman&;模拟用户登录请求_Ruby On Rails_Api_Postman - Fatal编程技术网

Ruby on rails 与postman&;模拟用户登录请求

Ruby on rails 与postman&;模拟用户登录请求,ruby-on-rails,api,postman,Ruby On Rails,Api,Postman,我正在用RubyonRails构建一个API。API有一个使用Deviate创建的身份验证系统。我想使用postman with http request测试我的API方法,但每次尝试都会得到以下响应: { "error": "You need to sign in or sign up before continuing." } 我如何在我的邮递员请求中模拟登录用户以使我的请求生效?或者有更好的方法来测试我的API吗?您需要基于令牌的身份验证,以便使用Desive正确验证API。令牌身份

我正在用RubyonRails构建一个API。API有一个使用Deviate创建的身份验证系统。我想使用postman with http request测试我的API方法,但每次尝试都会得到以下响应:

{
  "error": "You need to sign in or sign up before continuing."
}

我如何在我的邮递员请求中模拟登录用户以使我的请求生效?或者有更好的方法来测试我的API吗?

您需要基于令牌的身份验证,以便使用Desive正确验证
API
。令牌身份验证不再包含在
designe
gem中,但还有另一个名为designe的gem,它使用designe对使用令牌的api进行身份验证


在成功使用电子邮件和密码首次登录后,它会在响应标头中发送身份验证标头。您必须将这些标头用于发送给应用程序的每一个其他请求,以便正确进行身份验证

你的API真的使用基于cookie的身份验证吗?需要更多信息。API使用什么类型的身份验证?它是基于令牌的吗?我不太确定,我知道auth系统是用designe创建的&在模式中,users表有一个authentication\u token列。在这种情况下,有没有办法强制邮递员在上一次响应中出现新的令牌头后,每次刷新下一个请求的令牌头?