I am having issues with Google Oauth2

Perhaps the issue is you are calling it from localhost which is not a secure URL as it is HTTP not HTTPS.

Have you tried deploying to staging/ production server and seeing if error goes.

Alternatively you could use ngrok to allocate a secure https url as per below post.