Here is the google docs for doing this - https://developers.google.com/identity/protocols/oauth2
You can also try asking ChatGPT with this one, gives you a clear understanding of whats required