Skip to content

Instantly share code, notes, and snippets.

@ruseel
Last active August 1, 2018 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruseel/bab8c925822f7a500548376cf7f4f65b to your computer and use it in GitHub Desktop.
Save ruseel/bab8c925822f7a500548376cf7f4f65b to your computer and use it in GitHub Desktop.
Google AdSense API with ServiceAccount - Not possible

https://groups.google.com/forum/#!topic/adsense-api/tS_3G9OC8Eg

Google UK Limited에 근무하는 "Sérgio Gomes"가 service account로 AdSense Management API를 호출하는 것은 불가능하다고 했다.

you can't use service accounts with the AdSense Management API, since it accesses protected user data


https://stackoverflow.com/a/37303865/262425 에서도 불가능하다고 했고,


https://developers.google.com/adsense/management/getting_started 에서도

참고: 서비스 계정은 보호된 데이터에 액세스하므로 지원되지 않습니다.

라고 해서 service account로 adsense api를 호출하는 것은 앞으로 시도 안 하는 걸로.


cron 에서 사람의 개입없이 adsense 정보를 가져오게 하고 싶다면

  • 사람이 개입해서 access_token, refresh_token을 얻은 다음에 쓰고,
  • access_token이 만료되었다면 refresh_token으로 access_token을 새로 가져오게 하고,
  • refresh_token 이 만료되었다면 다시 처음으로 돌아가게 해서

쓴다. 사람의 개입없이 자동화하기는 (아는 한) 불가능하다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment