1

I am going to fetch Google Tasks via API on the server without using the browser but when I am calling the API, it gives me redirect link to authenticate the application as in the documentation here.

I don't want the redirection to browser, verify the application, and get the auth code. I just need to get the auth code when I call the API.

Is there any way to do it?

engrhussainahmad
  • 1,008
  • 10
  • 19
  • see https://stackoverflow.com/questions/19766912/how-do-i-authorise-an-app-web-or-installed-without-user-intervention – pinoyyid Aug 04 '20 at 19:32

1 Answers1

3

Answer

There is no way to achieve that using a normal account. You will have to use a Service Account.

Service Account

A Service Account is a special type of account which is used to execute API calls as a non-human user. So if you don't want any human user interaction during the authentication process, this would be the best way to go. Accordingly with the OAuth2 specification, this account will use a JWT (Json Web Token) to authenticate its API call. The Google API provides you with the scaffolding to use the Service Account credentials to build your services as you were doing with a normal account.

Further Reading

Here some recommended further reading and examples on Service Accounts

Understanding Service Accounts

PHP Service Account Sample

Alessandro
  • 2,848
  • 1
  • 8
  • 16