MobilityData / mobility-feed-api

Apache License 2.0
9 stars 4 forks source link

Fix download authentication feeds #783

Open davidgamez opened 3 weeks ago

davidgamez commented 3 weeks ago

Description

The implementation of the authenticated feeds seems to be broken as the authentication types 1 and 2 are flipped. This might be the case for why some authenticated feeds are not downloaded, example. In an interesting case, the feed mdb-1846 is present in the UI as it supports the _apikey parameter as a header and also a URL parameter.

Proposed solution

  1. As documented here make sure the implementation aligns with the proper authentication type. Authentication types: 0 or (empty) - No authentication required. 1 - The authentication requires an API key, which should be passed as value of the parameter api_key_parameter_name in the URL. Please visit URL in authentication_info_url for more information. 2 - The authentication requires an HTTP header, which should be passed as the value of the header api_key_parameter_name in the HTTP request.

  2. Set a default user-agent similar to link. This will revert #524 changes.

  3. To address the fix introduced in #524, add the feeds to header authentication and set the proper values to the API_SOURCE_SECRETS list.

Number 2 and 3 TBD pending team review

TBD: Allow multiple headers as part of the authentication 2.

jcpitre commented 1 week ago

Tasks: