Search code examples
nginxgoogle-oauth

Using a Google Service Account to access a GoogleAuth-protected site


I have an app that is protected by google-oauth (3-legged OAuth) at the nginx-level (using https://github.com/cloudflare/nginx-google-oauth). As you may know, it requires the user to be logged in or manually login to a google account using the browser.

I'd like to access this same protected app through the CLI/programatically. It's true that nginx-google-oauth provides some means that make it easy to do that: the _token_curl endpoint prints outs the headers ready to be used with curl. The problem though is that that token has an expiration date and to get it I need to be logged in or login manually to my google account.

I'm wondering if I could use a Google Service Account (2-legged OAuth) to access the google-oauth-protected app? I've searched around in the documentation (https://developers.google.com/identity/protocols/OAuth2ServiceAccount) and from what I understood, it's only meant to access Google APIs.

Could someone shed some light on the subject? Thanks!


Solution

  • Just for anyone else finding this, the question was answered on GitHub and it is not supported by nginx-google-oauth:

    https://github.com/cloudflare/nginx-google-oauth/issues/21