Hi, my goal is to build a dashboard (SPA) that helps visualize data processed using a Machine Learning algorithm.
I have built a Flask API that serves data from my database and checks/validates users using bearer tokens in the Authorization header. This API uses Auth0 to verify user info.
I have built a front-end using NextJS and am struggling with how I can use the nextjs-auth0 library to pass these bearer tokens to my API. I have followed the basic tutorial here and have all the login/logout pages.
The goal is to create a simple page on my NextJS front-end, which queries my Flask API at http://localhost:5000/data/datasets
and returns a bunch of datasets. From my basic understanding, getServerSideProps should allow me to accomplish this. However, I am having trouble figuring out how I can pass the accessToken to this function. There’s the option of using the NextJS API routes as a proxy but I feel like this would be slow and defeats the purpose of a Flask backend…
Seems like a trivial problem but I’m quite new to NextJS and would appreciate any help here! Thank you.