Skip to content
gurl auth

gurl auth

List the built-in auth handlers and the parameters each one accepts, so you know what to pass to --auth and --auth-param on gurl save and gurl edit.

Synopsis

gurl auth list
gurl auth info <type>

gurl run applies the auth saved on the request. Auth params may contain placeholders (token='{{API_KEY}}'); they are filled during request resolution, then the handler updates the outgoing request. Literal secret auth params are masked by show, list --json, codegen and paste.

TypeUse it for
basicHTTP Basic auth with username and password
bearerBearer tokens in the Authorization header
apikeyAPI key in a header or query parameter
oauth1OAuth 1.0 signed requests
oauth2OAuth 2.0 auth_code or client credentials flow
awsv4AWS SigV4 request signing
digestDigest Authorization headers from supplied challenge values
ntlmNTLM negotiate or challenge response headers

Subcommands

list

List the built-in auth types.

gurl auth list

None.

info

Show the parameters for one auth type, marked required/optional and secret, with defaults.

gurl auth info <type>

None.

Examples

See what a handler needs

gurl auth info bearer
Auth type: bearer
Parameters:
  token	required,secret	Bearer token value

Save bearer auth that reads a secret from the environment

gurl save "profile" '{{BASE_URL}}/me' \
  --auth bearer \
  --auth-param token='{{API_KEY}}'

gurl run "profile" --env prod

OAuth 2 client credentials

gurl save "service-token" https://api.example.com/service \
  --auth oauth2 \
  --auth-param flow=client_credentials \
  --auth-param client_id='{{client_id}}' \
  --auth-param client_secret='{{client_secret}}' \
  --auth-param token_url='https://auth.example.com/oauth/token' \
  --auth-param scope='read:orders'

To change or clear saved auth, use gurl edit <name> --auth ... or gurl edit <name> --auth none.

Related commands