How to properly integrate Google sign in using NextJS and external API?
Unanswered
Orangetailed potter wasp posted this in #help-forum
Orangetailed potter waspOP
Hi everyone!
I'm basically struggling to integrate google sign in with NextJS the way my web app requires, the thing needed is being able to save users with the google sub id in my external API database and return JWT for the access (so all the upcoming API calls are authenticated).
I tried with AuthJS but i think this dependency focus on solving the auth part if we don't use an external API. I ended doing it with "u/react-oauth/google" in a client component, but things got all messed up for proper authentication in the middleware and i basically ended doing another authentication in the nextjs app.
Please someone can enlighten me on how to proper solve this problem? massive thanks!!!
TLDR: How to implement google sign in for a NextJS app used as a frontend that calls my external API (which has protected resources for each user) and i wasn't able to make it work with AuthJS.
I'm basically struggling to integrate google sign in with NextJS the way my web app requires, the thing needed is being able to save users with the google sub id in my external API database and return JWT for the access (so all the upcoming API calls are authenticated).
I tried with AuthJS but i think this dependency focus on solving the auth part if we don't use an external API. I ended doing it with "u/react-oauth/google" in a client component, but things got all messed up for proper authentication in the middleware and i basically ended doing another authentication in the nextjs app.
Please someone can enlighten me on how to proper solve this problem? massive thanks!!!
TLDR: How to implement google sign in for a NextJS app used as a frontend that calls my external API (which has protected resources for each user) and i wasn't able to make it work with AuthJS.