I was working on the intuit-oauth and realised that I can't do axios.get to my 'api/auth/qb' which redirects me to the authorization page whose link gets generated in the backend. It throws a CORS error and the intuit-team has said in a forum that they don't support client side oauth(https://help.developer.intuit.com/s/question/0D50f00005pP1e5/cors-error-while-getting-access-token-using-url-httpsoauthplatformintuitcomoauth2v1tokensbearer) and hence the error.
the error:
Access to XMLHttpRequest at 'https://appcenter.intuit.com/connect/oauth2?client_id=<MY_CLIENT_ID>&redirect_uri=<MY_REDIRECT_URI>&response_type=code&scope=com.intuit.quickbooks.accounting%20openid&state=<MY_STATUS>' (redirected from 'http://localhost:3000/api/auth/qb') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
the next js pages structure:
pages
--index.tsx
--dashboard.tsx
--api
|--auth
|--qb.tsx
So, I planned to redirect the user to '/dashboard' from the backend once I get the access token and send the access token in the header, and then if i can extract the code in the nextJS page, I would store it in the local storage, so the question is: can I extract it on the next js page and if yes, how?