Google Cloud Endpoint API for Kubernetes Engine Authentication with Auth0

Cloud endpoints are used as a front to application deployed in GCP on app-engine or kubernetes engine. It provides the a number of features for securing, monitoring and overall management of programmatic access to applications deployed.

GCE provides three methods to deploy the endpoints:

For App-Engine specific deployment refer the documentation : Quickstart for Cloud Endpoints

Cloud Endpoints for kubernetes Engine:

To deploy the Cloud endpoints API for application deployed on Kubernetes Engine :

  1. Create and deploy the back-end application on the kubernetes Engine.
  2. Create and deploy the Cloud Endpoints for the application deployed onto the k8s cluster.

Refer link given below to complete the above two steps: https://cloud.google.com/endpoints/docs/openapi/get-started-kubernetes-engine

Authenticating the cloud endpoints

  1. Create or sign-up for Auth0 account
  2. Go-to the API section in Auth0 dashboard and create new API

3. Now edit the openapi.yaml file with the below given parameters in security definitions tag

securityDefinitions:
auth0_jwt:
authorizationUrl: "https://AUTH0_ACCOUNT}.auth0.com/authorize"
flow: "implicit"
type: "oauth2"
x-google-issuer: "https://AUTH0_ACCOUNT}.auth0.com/"
x-google-jwks_uri: "https://AUTH0_ACCOUNT}.auth0.com/.well-known/jwks.json"
x-google-audiences: "
http://google_api"

4. Now provide the security tag for method as auth0_jwt:[]

5. To get the bearer token you need to curl with the credentials of API created in auth0. find the test section of an API in auth0 to get all details.

6. Using the token provide by the above command you can access the Cloud Endpoint API.