Next.js App Directory redirecting POST route (oauth, sign in with google)
Hey folks!
I'm implementing "Sign in with Google" using the Google Identity Services (GIS) package and these docs: https://developers.google.com/identity/gsi/web/guides/overview
The TLDR is they provide a JS script and an HTML button. Once someone presses the button and authenticates successfully, GIS sends a POST request to URI that I give with the credential, csrf tokens etc.
At the end of the post request, I want to redirect the user to a different page and also set a session cookie. The following code works, but I'm wondering if there's a more "idiomatic" (correct) way of doing it?
I have tried using
NextResponse.redirect()
but it just hangs the backend.
I'm using Next.js 13.4.7 and the App directory.
Google for Developers
Overview | Authentication | Google for Developers
0 Replies