Package: httpie-oauth1
Authentication plugin forHTTPieto supportOAuth 1.0a.  HTTPie is a Python command line program that makes
HyperText Transfer Protocol (HTTP) requests. Plugins allow it to use
different authentication protocols.Note:OAuth 1.0a is very different to OAuth 2.0. This plugin
doesnotsupport OAuth 2.0.This plugin supports all the standardsignature methodsin OAuth
1.0a (as defined byRFC 5849):HMAC-SHA1RSA-SHA1PLAINTEXTIt also supports non-standardsignature methods, that replaces SHA-1
with more secure hashing algorithms:HMAC-SHA256HMAC-SHA512RSA-SHA256RSA-SHA512This plugin supportstwo-legged OAuth 1.0awith all the availablesignature methods.This plugin can be used to supportthree-legged OAuth 1.0awith
the PLAINTEXT and HMAC-basedsignature methods, if some values are
manually copied between the different requests.InstallationStandard install without RSAA standard install has all the HMAC-based and PLAINTEXTsignature
methods, but doesnothave any of the RSA-basedsignature methods.$pipinstallhttpie-oauth1Sincehttpie-oauth1depends onhttpie, this also installshttpieif it has not already been installed.Runhttp--helpand (under the “Authentication” section) the OAuth
1.0a authentication mechanisms (e.g. “oauth1-hmac-sha1”) will be
available for the--auth-type.Install with extras for RSATo include support for the RSA-basedsignature methods, install it
with the “rsa” extras:$pipinstall'httpie-oauth1[rsa]'That installs the standard install, plus the Python packages needed to
support the RSA cryptographic algorithms: PyCA’scryptographypackage and thePyJWTpackage. If the RSA-basedsignature methodsare not needed it may be easier to use the standard install, since
there can be problems installing the cryptography package on some
systems.Note: the quotes are necessary in some shells, because square brackets
are special characters.Runhttp--helpand (under the “Authentication” section) the
RSA-based OAuth 1.0a authentication mechanisms (e.g “oauth1-rsa-sha1”)
will be available for the--auth-type.UsageNote: The “client identifier” is what OAuth 1.0a calls the
“client key” or “consumer key”. But this document calls it the “client ID” to
avoid confusing it with the RSA public or private keys. The client identifier
is a string value that identifies the client: like a username does.HMAC-SHA1To use the HMAC-SHA1signature method, for the--auth-typeargument useoauth1-hmac-sha1.The argument to--authcan be just theclient identifier, and it
will prompt for theclient secret.The argument to--authcan also be theclient identifier, a
colon, a less-than sign, and the name of a file to read theclient
secretfrom.$http--auth-typeoauth1-hmac-sha1--authclientId...$http--auth-typeoauth1-hmac-sha1--auth'clientId:<secretsFilename'...Note: the quotes are necessary, because the shell treats the less-than
sign as a special character.The value can also just have theclient secretafter the colon (when
there is no less-than sign). But this is not recommended, because
putting passwords on the command line is insecure.$http--auth-typeoauth1-hmac-sha1--authclientId:clientSecret...See theAdvanced auth optionssection for more ways to use the auth
argument.RSA-SHA1To use the RSA-SHA1 signature method, for the--auth-typeargument useoauth1-rsa-sha1, and for the--authargument provide the client
identifier, followed by a colon, and followed by the name of a file containing
the RSA private key. The file must contain a PEM formatted RSA private key.$http--auth-typeoauth1-rsa-sha1--authclientId:filename...The filename can be a relative or absolute path to the file.Passphrase protected private keys are not supported.Including the client key in the private key fileThe preamble of the private key file can contain theclient
identifier. This makes HTTPie easier to use, since the command line
only needs the filename.To use this approach, the--authargument is just the private key
file name.Theoauth_consumer_keyparameter from the preamble, before the PEM
encoded private key, will be the client ID.For example, if the private key file contains something like this:oauth_consumer_key: myconsumerkey
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----Use it with this command:$http--auth-typeoauth1-rsa-sha1--authfilename...PLAINTEXTTo use the PLAINTEXT signature method, for the--auth-typeargument useoauth1-plaintextThe--authargument is the same as the HMAC–based signature
methods, and also supports the sameadvanced auth options.$http--auth-typeoauth1-plaintext--authclientId...$http--auth-typeoauth1-plaintext--auth'clientId:<secretsFilename'...Other signature methodsThe other signature methods work in the same way as HMAC-SHA1 and
RSA-SHA1, but using these arguments for the--auth-typeoption:oauth-hmac-sha256for HMAC-SHA256oauth-hmac-sha512for HMAC-SHA512oauth-rsa-sha256for RSA-SHA256oauth-rsa-sha512for RSA-SHA512Advanced auth optionsThe HMAC-based and PLAINTEXT signature methods supports many
properties with the--authargument. It can specify
these values to the request:client identifierclient secretresource owner identifierresource owner secretcallback URIparameter transmission mechanismThe argument processed as components separated by colons. It can have
between 1 to 4 components: identity, secrets, callback and type.  Components
populate the left-most value first.The identity component contains either just theclient identifier,
or aclient identifierandresource owner identifierseparated by
a semicolon. In the protocol, they appear as theoauth_consumer_keyandoauth_tokenparameters.The secrets component contains either just theclient secret,
aclient secretandresource owner secretseparated by a semicolon,
or a less-than sign followed by the name of a file to read the secret(s)
from.The callback URI, if it is not the empty string, appears in the
protocol in theoauth_callbackparameter. The callback URI
component ends at the last colon (or the end of the value), rather
than at the third colon. This allow the callback URI to contain
colons, which all URIs do.The parameter transmission mechanism indicates where the OAuth 1.0a
parameters appear in the request:“query” means in the URI query parameters;“body” means in the HTTP body; or“header” means in hthe HTTP “Authorization” header.The header is the default, if the parameter transmission mechanism is
not provided.The header is also the default, if the value does not match any of the
known values. In this situation, the value (and the preceding colon)
will be a part of the callback URI.ExamplesExamples--autharguments:--authclientId--auth'clientId:<secretsFilename'--authclientId:clientSecret--auth'clientId;resourceOwnerId'--auth'clientId;resourceOwnerId:clientSecret;resourceOwnerSecret'--auth'clientId:<secretsFilename:https://example.com/callback'--authclientId:clientSecret:https://example.com/callback--authclientId:clientSecret:https://example.com/callback:header--authclientId:clientSecret:https://example.com/callback:query--authclientId:clientSecret:https://example.com/callback:body--authclientId:clientSecret:https://example.com/callback:body:body--authclientId:clientSecret:https://example.com/callback:thisIsPartOfTheCallback--authclientId::https://example.com/callback--authclientId::https://example.com/callback:body--authclientId:clientSecret::body--authclientId:::body--auth'clientId;rsrcID:cSec;rsrcSec:https://example.com/callback:body'--auth'clientId;rsrcID:<secretsFilename:https://example.com/callback:body'Secrets fileThe first suitable line in the secrets file will be either theclient
secret, or theclient secretand theresource owner secretseparated by a semicolon.When searching for the first suitable line, it ignores empty lines and
lines with only whitespace.  Lines starting with a hash (“#”), with
optional whitespace before it, are also ignored.Example secrets file:# My secrets file
# Using a secrets file is secure and convenient
    # the secrets don't appear on the command line; and
    # it doesn't have to be interactively entered.

clientSecret;resourceOwnerSecretKnown limitationsclient identities,resource owner identities,client secretsandresource owner secretscannot contain colons or semicolons,
and cannot start with or end with whitespace.client secretson the command line cannot start with a less-than sign.UTF-8 is the encoding for the secrets file.HistoryThis plugin is a fork of thehttpie-oauthplugin,
which is no longer being maintained.TroubleshootingModuleNotFoundError: No module named ‘jwt’ThePyJWTmodule is not installed.Thishttpie-oauth1package depends on theoauthlibpackage, which
haspyjwt(andcryptography) as optional extra dependencies. They
are optional, since they are not needed for HMAC-based signatures. But
RSA-based signatures needs them.  Manually install thepyjwtPython package.Note: the name of the package to install is “pyjwt”, not “jwt”. They
both contain a module called “jwt”, but they are very different
implementations.$pipinstallpyjwtModuleNotFoundError: No module named ‘jwt.algorithms’It is trying to use the “jwt” package, which is the wrong package.Uninstall it and install the “pyjwt” package:$pipuninstalljwt# uninstall the wrong implementation of JWT$pipinstallpyjwt# install the correct implementation of JWTAttributeError: module ‘jwt.algorithms’ has no attribute ‘RSAAlgorithm’PyCA’scryptographymodule is not installed.See comment in the error about a missing “jwt” module.$pipinstallcryptography