MCP Tools

set_auth

Sets the auth of a request, folder, collection or workspace.

Overview

set_auth sets the auth of a request, folder, collection, globals or, by default, the workspace. auth is "inherit" to use the level above, "none" to turn auth off here and below, or one config keyed by its type.

Credentials must be {{variable}} references or empty, so a credential never passes through an agent. Refer to a secret variable (see set_variables) and enter its value in Relay. [secret] keeps the value already there.

{
  "collectionId": "A1F3D5B7-0C2E-4A6B-8D9F-1E3C5A7B9D02",
  "auth": { "bearer": { "token": "{{token}}" } }
}

Parameters

Prop

Type

Return Value

The level's auth as get_auth returns it, plus changed.

Discussion

The types are bearer, basic, apiKey, jwt, oauth2, oauth1, digest, ntlm, awsSigV4 and hawk. For example:

{ "basic": { "username": "{{user}}", "password": "{{password}}" } }
{ "apiKey": { "key": "X-API-Key", "value": "{{apiKey}}", "in": "header" } }

To see another type's fields, call get_auth on a level that uses it. A request uses the first level that doesn't inherit: its own auth, its folders' (innermost first), its collection's, the workspace's, then the global auth.

See Also

  • get_auth: Reads the auth a request, folder, collection or workspace sets.
  • set_variables: Adds, changes or removes variables in one scope.