Getting Started With Strapi - Episode 3: Authentication

Опубликовано: 31 Май 2020
на канале: CodingTheSmartWay
20,935
210

In the last episode we’ve created custom collection types by using Strapi’s admin panel. We’ve also added some sample data into the newly created collection types and we’ve started to use the REST API which is automatically provided for collection types.

So far we’ve used only unauthenticated access to retrieve data from Strapi by using HTTP GET requests in the browser. Therefore we’ve added corresponding collection types permissions to the Public role.

In this episode we’ll continue using the automatically generated REST API Strapi is providing for our custom collection types. This time we’ll not limit it to only retrieve data by using an HTTP GET request. We’ll also create new data by using an HTTP POST request. However, creating new data should not be possible for unauthenticated users. So we need to:

Add the corresponding permissions for the creation of data to the Authenticated role only
Create a new user which is assigned to the Authenticated role
Perform authentication by using JWT
Perform the HTTP POST request in an authenticated way

Using just the browser to send HTTP GET request to the Strapi API in the last episode is an approach which is very limiting when we want to have full control over our requests. Therefore we’ll switch to a tool which is called Postman. With Postman we’re able to take full control of our HTTP requests and responses.

This is a CodingTheSmartWay.com tutorial.

---------------------
Musik:
Night Owl by Broke For Free is licensed under a Creative Commons Attribution License.
(http://freemusicarchive.org/music/Bro...)

#strapi #javascript #backend #nodejs


Смотрите видео Getting Started With Strapi - Episode 3: Authentication онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь CodingTheSmartWay 31 Май 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 20,935 раз и оно понравилось 210 людям.