Restful响应错误:api密钥无效
我是meteor中restful api的新手。我从meteor厨师那里学习了restful api在meteor中的工作原理 以下是链接: 当我每次在POSTMAN上运行应用程序时,都会收到无效的api密钥Restful响应错误:api密钥无效,api,rest,meteor,restful-authentication,api-key,Api,Rest,Meteor,Restful Authentication,Api Key,我是meteor中restful api的新手。我从meteor厨师那里学习了restful api在meteor中的工作原理 以下是链接: 当我每次在POSTMAN上运行应用程序时,都会收到无效的api密钥错误:401 connection: function( request ) { var getRequestContents = API.utility.getRequestContents( request ), apiKey = getR
错误:401
connection: function( request ) {
var getRequestContents = API.utility.getRequestContents( request ),
apiKey = getRequestContents.api_key,
validUser = API.authentication( apiKey );
console.log(getRequestContents);
if ( validUser ) {
// Now that we've validated our user, we make sure to scrap their API key
// from the data we received. Next, we return a new object containing our
// user's ID along with the rest of the data they sent.
delete getRequestContents.api_key;
return { owner: validUser, data: getRequestContents };
} else {
return { error: 401, message: "Invalid API key." };
}
},
我正在服务器端使用此服务,并从else语句中获取此错误。if语句即使在console.log
之后也不显示任何值。它只是在服务器上显示null