Next.js Tutorial - Part 7 | Consume Authenticated APIs with cookies

Published: 31 March 2020
on channel: Bruno Antunes
43,654
1k

This video shows how to consume Authenticated APIs (both Server-side rendering and client-side rendering). We will check the page authentication status based on the API responses.

In this simple example, If the API response status is 401, it means the user is not logged in, so we redirect them to the /login page.

In order to call the API from server-side rendering, we are "forwarding" all the cookies we receive from the client to the fetch (API) call.

----
Repository: https://github.com/bmvantunes/youtube...
----
Next.js Examples: https://github.com/zeit/next.js/tree/...
----
MDN Set-Cookie: https://developer.mozilla.org/en-US/d...
----
React Forms with Formik - Video:    • Formik: React Forms Tutorial with Yup...  
----

Follow me on:
Twitter:   / bmvantunes  
Dev.to: https://dev.to/bmvantunes
Website: https://brunoantunes.net
Github: https://github.com/bmvantunes
LinkedIn:   / bmvantunes  


Watch video Next.js Tutorial - Part 7 | Consume Authenticated APIs with cookies online without registration, duration hours minute second in high quality. This video was added by user Bruno Antunes 31 March 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 43,654 once and liked it 1 thousand people.