Skip to contents

Retrieves token if not provided in `auth_token`, then add a `Authorization` header via add_headers to the API call.

Usage

authenticate_api(auth_type, auth_key = NULL, api)

Arguments

auth_type

(character) Two types of authentication are possible: - `client`: use the `auth_key` `user:password` to authenticate to the kobo API - `token`: uses the `token` provided in `auth_key` to authenticate

auth_key

(character) Can either be: - A combination of the kobo and password in format: `user:password` (e.g. 'my_user:my_password') - A kobo API V2 token. See the https://support.kobotoolbox.org/api.html

api

(character) The type of API to be used or URL at which the API can be accessed. Can be either: - `humanitarian_response`: "https:://kobo.humanitarianresponse.info" will be used as the base URL (default) - `kobotoolbox`: "https:://https://kf.kobotoolbox.org" will be used as the base URL - `custom`: custom URL. Must at least start with "https://"

Value

`Authorization` header call via add_headers

Details

All authentication is based on token.