I am creating a web application which has three distinct components as far as I understand. A Nuxt frontend, and Spring Boot backend and Google OAuth2 for authentication using OpenID Connect. Nuxt can be extended with Nuxt-Auth which has support for OAuth2. I just need to give it my Google OAuth2 Client ID and two endpoints for getting a token and user information.
My frontend will not be served use server-side rendering. The REST backend will be a datastore to the frontend via secured CRUD endpoints. This is why I would like to use Google's OAuth2.
The main trouble I'm having with implementing this is finding resources about how everything works together. It seems like I've come up with a very niche use case however, it seems very common all over the internet, so I'm not sure what gives.
I've included a sequence diagram of how I understand the system should work.
First the user attempts to login with Google. They are redirected to the Google OAuth consent screen where they agree to their data being used by the application. This redirects the user back to my frontend with a code. (After this happens, I want the user to be able to browse on the webapp normally without having to re-authenticate each time they invoke a new request to the backend.)
I need to take that code and pass it to my backend because that contains my Google OAuth Client Secret which I must use to get a token. The token will enable me to get data about the user such as their name, email and whatever else is permitted by Google's OIDC scope.
Everything past this point is a grey area. I'm not sure what should happen.