Authentication plays a crucial role in fetching real data from Google platforms like Gmail, Google Ads, Google Analytics, etc. When you try to authenticate your account to fetch data via API, you need to follow some steps. But there are two methods you can use. Both methods do the same job in authentication.
In this guide, we’ll see about two methods and how to generate an access token using them.
Tow methods
OAuth client 2.0
Service account
Feature Client 2.0 Service Account
Acts as Behalf of a user application itself
Requires user login? Yes ✔ No ❌
Best for User facing apps server to server or automation apps
Credentials Clinet ID and Client secret needed JSON key file
Token type Access token and refresh token Only access token
Token expiry Expire after every hour Don’t expire untill revoke
Prerequesites
Google Cloud console account with the email ID https://cloud.google.com/
Appropriate Google product login.…