Menu

1 / 4

Google OAuth 2.0 vs Service account: Which one should you use?

DEV Community·Sasireka Balasubramaniyam·6 months ago
#8Yt8Y0Zi
#how#method#generate#google#token
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.