简体   繁体   English

必须进行环回注销access_token

[英]loopback logout access_token is required

I want to test loopbacks logout endpoint. 我想测试回送注销端点。 But it returns access_token is required. 但是它返回access_token是必需的。 what is the correct JSON body to feed or the loopback user logout endpoint? 什么是正确的JSON正文或回送用户注销端点?

This code snippet will logout your user. 此代码段将注销您的用户。

User.logout('asd0a9f8dsj9s0s3223mk', function (err) {
         console.log(err || 'Logged out');
       });

Reference 参考

I assume you aren't setting the access token on the Loopback API Explorer. 我假设您没有在Loopback API资源管理器上设置访问令牌。

You will find this access token section on the top right corner of your API Explorer. 您将在API资源管理器的右上角找到此访问令牌部分。

API资源管理器

  1. Copy the access token returned by the login API here. 在此处复制登录API返回的访问令牌。
  2. Paste it on the accessToken section and click 'Set Access Token' 将其粘贴在accessToken部分,然后单击“设置访问令牌”
  3. Try calling the logout API now 尝试立即调用注销API

UPDATE 更新

To call from a client. 从客户打电话。 Add the Access token as a query parameter or header. 将访问令牌添加为查询参数或标头。

ACCESS_TOKEN=6Nb2ti5QEXIoDBS5FQGWIz4poRFiBCMMYJbYXSGHWuulOuy0GTEuGx2VCEVvbpBK

# Authorization Header
curl -X GET -H "Authorization: $ACCESS_TOKEN" \
http://localhost:3000/api/widgets

# Query Parameter
curl -X GET http://localhost:3000/api/widgets?access_token=$ACCESS_TOKEN

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM