Authorization via Google e-mail
Also, the user must be able to sign in/sign up using Google auth. In the classic auth we know, that we need to check, that user's e-mail is exist and the e-mail really belongs to the user, but in this situation, Google auth handle these tasks, so we do not need to do it ourselves.
Registration flow
The user clicks the Google button
The modal window by google with e-mails is shown. The user chooses e-mail
If account with this e-mail is already exists, we need to show info about it
Otherwise, the account is creating and we redirect user to dashboard page
Login flow
The user clicks the Google button
The modal window by google with e-mails is shown. The user chooses e-mail
If account with this e-mail does not exist, we need to show info about it
Otherwise, we redirect user to dashboard page
Info for devs - auth types (req/res)
Types for registration and login are similar, so:
If this is registration
If this is logining
Explanation: the frontend does auth via Google API and gets google-jwt. Then frontend sends HTTP GET request to the backend, backend decodes google-jwt and extracts info from payload
The email, name, picture, given_name, family_name fields are needs for auth.