Search code examples
oauth-2.0google-cloud-functions

Google Cloud Function Authentication using Oauth2


What I have:

A google cloud function and an HTTP trigger like : https://us-central1-{project_name}.cloudfunctions.net/{function_name}.

Currently, I have set unauthenticated access by selecting allUsers in the permissions of the cloud function.

A web application that needs to call this cloud function.

What I want:

Implement authentication for this function.

Any step by step guide to implement Oauth 2 authentication for a google cloud function (without the need to add any code in the cloud function end) will be highly appreciated.


Solution

  • It seems I was doing something wrong and not thinking about this clearly. I started from scratch and followed the link https://cloud.google.com/functions/docs/securing/authenticating and was able to generate the bearer token.

    Thanks for the help in the comments section.