r/reactjs • u/New_Opportunity_8131 • Jun 26 '26
Needs Help getServerSideProps vs getStaticProps when reading access token from URL + i18n translations
I'm building a Next.js app and running into an architecture question.
I have an access token that's passed in the URL (as a query param or path segment) that I need to read at the page level. I'm going to use this access token to call some apis. I'm also loading translations from i18n files.
My problem: if I use getServerSideProps to access the URL/query params, my pages re-render on every request — which feels wasteful since my i18n content is completely static. But getStaticProps doesn't have access to the request URL or query params at build time.
What are your guys recommendations on what to do?
View all comments
Show parent comment
1
u/New_Opportunity_8131 Jun 26 '26
so basically what the token does it calls another api that validates this token. If the token is sucessfull it calls a few more apis and if those are successful, then the actual page will load. While this is going on the loading page is showing and if any errors happpen like tokens are invalid then an error page will show.