google-oauthmetabase

Using Metabase API behind google oauth


I have a Metabase Docker image running locally that is routed to the URL:

https://metabase.example.com

I am trying to. do a curl on this to grab a Metabase token to use the Metabase API; however, this URL is hidden behind Google oauth, so I believe I need to first get a google oauth token for the test@company.com service account I am using which I can then pass to the curl request below.

curl --location --request POST 'https://metabase.example.com/api/session/google_auth' \
--header 'Content-Type: application/json' \
--data-raw '{"username": "test@company.com", "password": "password123"}'

Is there a simple way I can grab this Google Oauth token via CURL to then use in the above curl statement for metabase?


Solution

  • The workaround that I have found is port forwarding.

    Assuming you are using Kubernetes, you can take your Kubernetes Metabase deployment and run this command:

    kubectl port-forward deployment/metabase-deployment :3000

    This will generate a port like:

    Forwarding from 127.0.0.1:12345 -> 3000

    You can then use that use that port like below:

    POST 'https://localhost.com:12345/api/session'

    To generate a token session and use the Metabase API behind a reverse proxy.