Authorization Flow

I have wrote an api in c# which at the moment is connected to a React App but I would like to switch to bubble . The authentication is done using refresh and access tokens which are stored as cookies.
I have exposed 2 endpoints :

  1. /api/token: which receive a JSON with email and password (credentials) and if correct gives back a access_token and refresh_token .
  2. /api/refresh_token :* which given a refresh_token returns a new access_token

Once logged in, every request I make, I attach the access token to the header like this Bearer access_token .

In React I use an interceptor that check if I receive a status code = 410 (TokenExpired) . In such case I call the /api/refresh_token and I get a new access_token and make the call again.

Is there a way to do so in bubble or i have to change my authentication process