LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

twurl-authorize

Authorize twurl with Twitter/X API credentials

TLDR

Authorize with consumer key and secret (interactive PIN flow)
$ twurl authorize --consumer-key [key] --consumer-secret [secret]
copy
Authorize using short option names
$ twurl authorize -c [key] -s [secret]
copy
Generate a bearer token (application-only authentication)
$ twurl authorize --bearer --consumer-key [key] --consumer-secret [secret]
copy
Authorize against a non-default host
$ twurl authorize -c [key] -s [secret] -H [api.twitter.com]
copy
Authorize for a specific username
$ twurl authorize -c [key] -s [secret] -u [username]
copy

SYNOPSIS

twurl authorize [-c|--consumer-key key] [-s|--consumer-secret secret] [options]

DESCRIPTION

twurl authorize is the first step when using twurl, Twitter's OAuth-enabled curl replacement for the X (Twitter) API. It registers a consumer key and secret with a user account (or generates an application-only bearer token), then saves the resulting credentials so later twurl requests are signed automatically.For user-context OAuth, the tool prints an authorization URL. Open it in a browser, sign in to X, and enter the returned PIN back into the terminal. On success, credentials are written to ~/.twurlrc and that profile becomes the default if none existed yet.With --bearer, twurl authorize obtains and stores a bearer token for application-only calls. Subsequent requests can pass --bearer (and optionally -c) to use that token without a user context.Multiple accounts and consumer keys can be authorized over time. Use twurl accounts to list them and twurl set default to switch the active profile.

PARAMETERS

-c, --consumer-key key

OAuth consumer (API) key. Required. If the value is omitted, twurl prompts interactively.
-s, --consumer-secret secret
OAuth consumer (API) secret. Required. If the value is omitted, twurl prompts interactively.
-u, --username username
Username of the account being authorized.
--bearer
Use application-only authentication and store a bearer token instead of a user access token.
-H, --host host
API host used during authorization (default: api.twitter.com). Protocol prefix is stripped if present.
-a, --access-token token
Supply an existing access token instead of running the full PIN handshake.
-S, --token-secret secret
Supply an existing token secret to pair with --access-token.
-P, --proxy proxy
HTTP proxy to use for the authorization requests.
-t, --trace
Trace request and response traffic during the handshake.

INSTALL

nix profile install nixpkgs#twurl
copy

CAVEATS

Requires a developer account and app credentials from the X Developer Portal. The authorize flow needs interactive PIN entry (or pre-supplied tokens). X API product tiers and endpoint access change over time; successful authorization does not guarantee every endpoint is available to your app. Ruby and the twurl gem must be installed.

HISTORY

twurl was created by Twitter (now X) as a development helper for its HTTP API. The authorize subcommand has always been the entry point for storing OAuth credentials in ~/.twurlrc.

SEE ALSO

twurl(1), twurl-accounts(1), curl(1), httpie(1)

RESOURCES

Copied to clipboard
Kai