Article directory
1. Debugging of public users
For public users, if it is a get request, even if they are not in postman, it is easy to directly access the API in the browser and see the return interface.
First of all, if it is public
a user, that is, if the request header is not included, Authorization
it is automatically public
a user.
Then, if you are a user, every time you create a new article type, you need to check the corresponding permissionspublic
in the corresponding public
permissions .
As shown below:
In this way, the interface can be debugged. If it is not checked, the debugging permission cannot be obtained .
As shown in the figure below, after checking, you can directly debug the interface in the browser or postman, and the corresponding content will be returned. Otherwise it will show no permission.
2. Debugging of authenticated users
Some content requires users to log in to access, and authentication is required in this case. That is, the token needs to be carried when requesting. Specific steps are as follows:
1. Create a new user to obtain token
2. Call the interface for obtaining token to obtain token
Create a new request in postman, the request url is: 你的域名/api/auth/local
, click send, and you can get the token. Message as follows:
After getting the token, you can call any interface that requires authentication.
3. Bring the token to call the permission interface when requesting
For example, if you want to get a list of categories, go to the permissions and check it first , and the steps are the same public
. Once you know it API地址
, you can post it postman
.
Then switch to Authorization
the panel, select Bearer token
, enter the token obtained in the previous request, and click 发送
:
If the information is filled in correctly token
and has not expired, then the corresponding content will be obtained:
3. Reference link
How to initiate an authentication request: https://docs.strapi.io/dev-docs/plugins/users-permissions#login
If you have difficulties in web front-end development, interviews, and front-end learning routes, you can add me V: imqdcnn. Answer questions for free, and technical experts who have been deep in the industry for many years will help you solve bugs.
I wish you can become an excellent WEB front-end development engineer!