Introduction
The API requires a token sent on each request via the Authorization header to authenticate. This token can be obtained by making a POST request to the URI /auth/request-token where you would include your VSKEY credentials using the Authorization Header.
Request Access Token
This section shows how to request an access token using HTTPie and CURL.
On this page:
HTTPie
http POST https://vss-api.eis.utoronto.ca/auth/request-token -a <username> http: password for <username>@vss-api.eis.utoronto.ca:
CURL
curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username> Enter host password for user '<username>':
Unauthorized
Getting a 401 Unauthorized error as shown below when requesting a new access token, could be due to the following reasons:
Username and password combination is not valid
Re-initializing your VSKEY credentials is strongly advised. To do so, please follow this KB Article.
User is not permitted to access the API
Contacting the VSS Team to request access is advised by email or our contact form.
Using Access Token
At this point you have already generated an access token to use the API valid for a certain period of time. Now, this token can be used for every request made to a given API endpoint via GET, POST, PUT, PATCH.
There are two separate approaches to authenticate using OAuth: Bearer Authorization Header and Basic Authentication described in the following sections:
Bearer Authorization Header
The first approach is sending a bearer authorization header within your request, which will authorize the request from the header section. The following examples illustrate how to pass the Authorization header with CURL and HTTPie
http GET https://vss-api.eis.utoronto.ca/v2 "Authorization: Bearer $VSS_API_TOKEN" curl -X GET -H "Authorization: Bearer $TK" https://vss-api.eis.utoronto.ca/v2
Basic Authentication
The second approach is using basic authentication as shown below:
http GET https://vss-api.eis.utoronto.ca/v2 -a $TK: curl -X GET https://vss-api.eis.utoronto.ca/v2 -u $TK:
Look closely at the colon appended to the token environment variable.
Unauthorized
Getting a 401 Unauthorized error as shown below when using an access token, could be due to the following reasons:
Expired Token
Generate a new token as previously described /auth/request-token
Invalid Token
Either a typo or something at our end went wrong. Just generate a new access token at /auth/request-token
User is no longer authorized to access the API
Contacting the VSS Team to request or restore access is advised by email or our contact form.