I'm facing an issue on how implement the authorization code flow with a complex architecture composed of :
• a SPA executed on the web browser (Nuxt)
• a frontend server (Node) use to serve the SPA and static page
• a backend (Java) there to act as a BFF to communicate with the APIs and IDP
The backend is responsible to communicate with our IDP, exchanging the code against the token, refreshing the access_token in case it is expired.. The pair of tokens are stored in the backend (in memory or DB) linked to the user session. This session ID is then transferred to the web browser.
Is this implementation OK ? I don't know which component is responsible to generate the state parameter and which one should do the comparaison operation ? Is the PKCE required as the authorization code transit through the frontend ? Do you have any advice ?
Here you can find the sequence diagram I try to implement