Simplifying API Access Flows That Requires Authentication In A Javascript Application

İbrahim Gündüz
The Startup
Published in
3 min readMay 1, 2020

--

Most of the API’s requires some authentication mechanisms in order to identify the user and allows to access some resources based on the authorization rules. Although the way of the identity declaration changes, most of the authentication mechanisms requires to perform a request to an authentication endpoint in order to obtain an identifier before going to the actual resource. However, you can’t use that identifier forever.

If you take all this information into consideration, to make even a simple API call requires the following flow:

Today, we’re gonna see how to simplify your application flow by using Axios library while accessing an API that requires authentication.
Axios is a promise based advanced HTTP client library. I would like to prefer Axios to explain this subject since it’s an HTTP client library that works in both backend and frontend applications through the adapters it has.

Let’s take it to step by step:

Handling New User Authentication

--

--