Sometimes you build yourself a web application. You have the frontend and the backend. You don’t want other people to be able to access your backend, so you must protect it somehow.
This library provides a simple way to protect your backend with Google Sign-In.
On the frontend, use this library to authenticate user and get an ID token. Send this ID token to the backend.
On the backend, verify the ID token’s integrity to authenticate yourself. See Verify the integrity of the ID token on Google Sign-In for Websites documentation. Validate the
subclaim to make sure it’s you. Here’s an example in the wild.
To create an OAuth 2.0 Client ID:
Enter a name for the application.
Note the Client ID.
export const signInController = new GoogleSignInController(clientId)
For usage see API documentation.