package
0.22.3
Repository: https://github.com/grokify/goauth.git
Documentation: pkg.go.dev

# README

Metabase

Usage

Using default environment variable names:

import ("github.com/grokify/goauth")

httpClient, authResponse, clientConfig, err :=
  metabase.NewClientEnv(nil)

Authentication

To query the Metabase API you need to retrieve a bearer token. You can do this with the following cURL command which is also implemented in the AuthRequest function:

curl -v -H "Content-Type: application/json" \
  -d '{"username":"myusername","password":"mypassword"}' \
  -XPOST 'http://example.com/api/session'

You will receive a response like:

{"id":"11112222-3333-4444-5555-666677778888"}

You can then use the id in the X-Metabase-Session header for subsequent API calls. Here's an example:

curl -XGET 'https://example.com/api/database' \
  -H 'X-Metabase-Session: 11112222-3333-4444-5555-666677778888'

# Packages

No description provided by the author

# Functions

AuthRequest creates an authentiation request that returns a id that is used in Metabase API requests.
No description provided by the author
No description provided by the author
No description provided by the author
NewClient returns a *http.Client that will add the Metabase Session header to each request.
NewClientPasswordWithSessionId returns a *http.Client first attempting to use the supplied `sessionId` with a fallback to `username` and `password`.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
Example environment variables.
#nosec G101.
No description provided by the author
#nosec G101.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Config is a basic struct to hold API access information for Metabase.
No description provided by the author
No description provided by the author
No description provided by the author