I would suggest you use Google Identity Platform (via OAuth 2.0) to authenticate users, but you should not directly call Google’s Identity Platform API from your backend to generate JWT tokens.
Here are the recommended approaches:
Use Flutter App for your Frontend to handle the initial authentication flow with Google’s OAuth 2.0 APIs (via the google_sign_in package in Flutter). Upon successful login, the app receives an ID Token from Google.
As the ID token is sent to the backend, the backend verifies this token using Google's public keys to ensure its authenticity. Then, the backend assigns roles to the user (from your database) and generates its own JWT (session token) for further secure requests from the frontend.
Here are some helpful links: