What I'm doing now:
- Using the JavaScript API to render the button on my web page.
- When the Sign in with Google flow is complete, my client-side JavaScript callback is called.
- That callback sends the given
.credentialsstring to my server. - The backend server (Node.js) calls the google-auth-library library's
OAuth2Client.verifyIdtokenmethod on the.credentialsstring, which returns the user's email address (among other things), which my server uses to verify the user and create a session.
Everything works, but I'm wondering if there are any security concerns I'm missing. In particular there's a nonce field. The docs (link) don't explain how to use it.
Note: I'm using "Sign in with Google" and not the deprecated "Google Sign-In".
Edit: I'm familiar with the concept of nonces and have used them when doing the OAuth 2 server-side flow myself. What I can't figure out is how the Sign in with Google SDK expects me to use its nonce parameter with the flow above, where I'm using both their client-side and server-side SDKs.