Setting up Google OAuth Consent Screen for Development
Step 1: Go to google cloud console and create a new project
Step 2: In API and services in your project enable OAuth consent screen
This is the screen that comes when you say you want to login through google and give the necessary permissions.
Step 3: Select external user so you can use any test user with any google account
As it is external your app will be available only to users that are test users only users you add to the list only they can access it
Step 4: After that you need to name your project , logo and your user support email and developer email .
Name and logo will be visible in the OAuth consent screen and provide your developer contact and user support contact Email.
Step 5: Scopes express the permissions you request users to authorize for your app and allow your project to access specific types of private user data from their Google Account. Select Scopes according to your usecase.
Step 5: Add the test user which could access your OAuth.
Step 6: Click on credentials Tab . Specify the authorized javascript origin URI and authorized redirect URI.
The “Authorized JavaScript origins” specify which domains are allowed to send requests to Google’s authentication endpoints from your frontend. Generally you add the base URL of your frontend application.
The “Authorized redirect URIs” are the URLs where Google will redirect users after they authenticate. This is where your application will receive the authentication response, such as an authorization code or access token, which your backend can use to exchange for user credentials. Generally add the full URL of the backend which will handle this.
Step 7: Finally Copy the Client ID and Client Secret which will be required for you backend application.