Skip to content
curl

Authentication

Basic, bearer, and OAuth credentials.

#auth#basic#bearer

Code

curl
# Basic auth
curl -u user:pass https://api.example.com/secure

# Bearer token
curl -H "Authorization: Bearer TOKEN" https://api.example.com/me

# Use a .netrc file for credentials
curl -n https://api.example.com/secure

# OAuth client credentials grant
curl -X POST https://auth.example.com/token \
  -d "grant_type=client_credentials" \
  -u "clientId:clientSecret"