API Reference

Authorization helpers.

vws_auth_tools.rfc_1123_date() str

Return the date formatted as per RFC 2616, section 3.3.1, rfc1123-date.

This is the date needed by the VWS API, as described in https://developer.vuforia.com/library/web-api/vuforia-web-api-authentication.

vws_auth_tools.authorization_header(*, access_key: str, secret_key: str, method: str, content: str | bytes | None, content_type: str, date: str, request_path: str) str

Get an Authentication header for the VWS API.

This can be used for a request made to the VWS API with the given attributes.

See https://developer.vuforia.com/library/web-api/vuforia-web-api-authentication.

Parameters:
  • access_key – A VWS server or client access key.

  • secret_key – A VWS server or client secret key.

  • method – The HTTP method which will be used in the request.

  • content – The request body which will be used in the request.

  • content_type – The Content-Type header which is expected by endpoint. This does not necessarily have to match the Content-Type sent in the headers. In particular, for the query API, this must be set to multipart/form-data but the header must include the boundary.

  • date – The current date which must exactly match the date sent in the Date header.

  • request_path – The path to the endpoint which will be used in the request.

Returns:

An Authorization header which can be used for a request made to the VWS API with the given attributes.

vws_auth_tools.basic_authorization_header(*, client_id: str, client_secret: str) str

Get an Authorization header for an OAuth2 token request.

The Model Target Web API does not use the VWS signature scheme which authorization_header implements. Instead, a token is requested from POST /oauth2/token with grant_type=client_credentials and HTTP Basic credentials, and the returned bearer token is then sent to the dataset endpoints with bearer_authorization_header.

Performing the token request, and caching the returned token, are left to the caller.

See https://developer.vuforia.com/library/vuforia-engine/web-api/model-target-web-api/.

Parameters:
  • client_id – A Model Target Web API client ID.

  • client_secret – A Model Target Web API client secret.

Returns:

An Authorization header which can be used for a request made to the Model Target Web API token endpoint.

vws_auth_tools.bearer_authorization_header(*, access_token: str) str

Get an Authorization header for a Model Target Web API request.

This is used for requests to the Model Target Web API dataset endpoints, with an access token obtained from a token request made with basic_authorization_header.

See https://developer.vuforia.com/library/vuforia-engine/web-api/model-target-web-api/.

Parameters:

access_token – An access token returned by the Model Target Web API token endpoint.

Returns:

An Authorization header which can be used for a request made to the Model Target Web API dataset endpoints.