Send requests as a signed-in user
An API can know who asks by a cookie, a token, a user and password, or a key. TotalAPI sends any of them.
On this page
With cookies
Send the request that signs in. TotalAPI keeps the cookies of the answer and sends them with the next requests, so these go as that user.
Each environment has its own cookies: you can be one user in your computer and another in production. They are forgotten when you quit TotalAPI.
To sign out, choose Forget the cookies of this environment among the commands (⇧⌘P on the Mac, Ctrl+Shift+P on Windows and Linux).
With a token, a password or a key
Open the tab Auth of the request and choose in Sign in with:
| Choice | What is sent |
|---|---|
| As its folder | What its folder or the collection has. It is the choice of a new request |
| None | Nothing |
| Bearer token | The header Authorization: Bearer …, with the Token |
| User and password | The header Authorization: Basic … |
| A header of its own (API key) | The Header that you name, such as X-API-Key, with its Value |
If you write an Authorization header in Headers yourself, that one is sent, and not the one of the token or the password.
Set it once for many requests
- For the whole collection, press the key next to its name, or choose Auth of the collection… among the commands (⇧⌘P on the Mac, Ctrl+Shift+P on Windows and Linux).
- For a folder, right-click it and choose Auth…
Choose how to sign in, as in a request, and press Done. The requests that say As its folder use it, also in the folders inside. A folder that says As its folder or As the collection takes it from where it is, and one with another choice has its own.
The tab Auth of a request that says As its folder tells what it sends now, and whether it comes from a folder or from the collection.
Keep the token out of the file
Write {{token}} as the token, and keep the value in a secret variable with that name.
A token, a password or a key written directly in an auth or in Headers is saved in the file of the collection, as it is. Whoever has the file can read it.
When the API gives the token in an answer, TotalAPI can put it in the variable each time you sign in.