Adding Authorization Headers

Some REST APIs will be secured and may require authorization to access some resources. The usual way of authorizing a request is by using a bearer token (for example, a JSON Web Token). You can add a token to the JadeRestRequest object by using the addBearerToken method, as follows.

request.addBearerToken(token);

If any token has been added with the addBearerToken method, an Authorization: Bearer HTTP header will be added to the request and the most‑recent token will be used. (You never need to include more than one authorization bearer token.)