Signing requests with OAuth 1.0
Sign requests with OAuth 1.0a consumer and token credentials.
Overview
OAuth 1.0a APIs expect each request to carry a signature made from its method, URL and parameters, keyed with the client's credentials. Relay signs each request when it sends it, with a fresh timestamp and nonce.
Relay signs requests with credentials you already have. It doesn't run the OAuth 1.0 flow that obtains an access token, so get the token and token secret from the provider first.
To use OAuth 1.0, open the Auth tab of a request, folder, collection or workspace, click the auth type menu and choose OAuth 1.0.
Enter your credentials
The Credentials card holds the values the provider issued:
- Consumer Key: The client's key. Relay can't sign without it.
- Consumer Secret: The client's secret.
- Access Token: The token, sent as
oauth_token. Optional, for requests made without a user. - Token Secret: The token's secret. Optional.
With an RSA signature method, the consumer secret and token secret aren't used, and the form hides them.
Choose a signature method
In the Signing card, choose a Signature Method:
| Method | Signs with |
|---|---|
| HMAC-SHA1 | The consumer secret and token secret. This is the default. |
| HMAC-SHA256 | The consumer secret and token secret. |
| HMAC-SHA512 | The consumer secret and token secret. |
| RSA-SHA1 | An RSA private key. |
| RSA-SHA256 | An RSA private key. |
| RSA-SHA512 | An RSA private key. |
| PLAINTEXT | Nothing: the consumer secret and token secret are sent as the signature. Use it only over HTTPS. |
For an RSA method, paste the key into Private Key in PEM format, including its -----BEGIN RSA PRIVATE KEY----- or -----BEGIN PRIVATE KEY----- line. The key can't be protected with a passphrase.
HMAC and RSA signatures cover the request's method, its URL, its query parameters and, for a form URL-encoded body, the body's fields.
Choose where the parameters go
Send Parameters In decides where Relay puts the oauth_ parameters and the signature:
- Header: In an
Authorization: OAuth …header. This is the default. - Query: Added to the URL's query.
- Form Body: Added to the request's form URL-encoded body. A request without a form URL-encoded body sends them in the header instead.
If the request has its own Authorization header in the Headers tab, Relay doesn't add one, and the request isn't signed unless the parameters go in the query.
Adjust advanced options
Click Advanced to show settings some providers need:
- Callback URL: Sent as
oauth_callback. - Verifier: Sent as
oauth_verifier. - Realm: Sent in the
Authorizationheader. It isn't part of the signature. - Timestamp and Nonce: Fixed values to use. Leave them empty to have Relay generate them for each request.
- Include oauth_version: Send
oauth_version=1.0. It's on by default. - Add a body hash: Add
oauth_body_hashfor bodies that aren't form URL-encoded. - Send empty parameters: Sign and send an empty access token, callback or verifier rather than leaving it out.
See Also
- Inheriting authentication: Set authentication once on a workspace, collection or folder and let requests inherit it.
- Authorizing with OAuth 2.0: Get, refresh and send OAuth 2.0 access tokens with the authorization code or client credentials grant.
- Keeping secrets on your Mac: Keep tokens and passwords out of shared workspace files.