Authentication on Real-Time-Updaters

74 views
Skip to first unread message

Tobias Walter

unread,
Apr 19, 2022, 10:00:12 AM4/19/22
to OpenTripPlanner Developers
Dear everybody,
we would like to use two GBFS Feeds, which unfortunately presume authentification.
One feed needs a Bearer Token and the other one needs OAuth2 as authentification.

Is there any opportunity to configure Feeds in OTP with these authentification settings?

Thank You for any help.
Greetings Tobias

Stefan de Konink

unread,
Apr 19, 2022, 10:18:12 AM4/19/22
to opentripp...@googlegroups.com
Why are these feeds not available as open data?

--
Stefan

Tobias Walter

unread,
Apr 19, 2022, 10:46:29 AM4/19/22
to OpenTripPlanner Developers
I can`t give you an answer to that question. A lot of providers in Germany force users of their data, to create an account. Unfortunately, this is a really common bad practice in Germany. It does not make sense to me either

mpa...@actransit.org

unread,
Apr 19, 2022, 7:33:20 PM4/19/22
to OpenTripPlanner Developers
You could setup a SOCKS5 proxy, accessible only to your org, which will open the API to your OTP installation.  The proxy would do the ODIC setup.

Andrew Byrd

unread,
Apr 20, 2022, 12:45:34 AM4/20/22
to Tobias Walter, opentripplanner-dev
Hi Tobias,

Pull request 3533 [1] made it possible to specify HTTP headers for bike rental updaters. This was merged in July 2021 so it should be available in OTP 2.1.

The documentation at http://docs.opentripplanner.org/en/latest/RouterConfiguration/#gbfs-configuration does not contain an example of this so ideally we should update it for future reference.

I have not used this myself so take this with a grain of salt, but based on the PR source code, it looks like you could just add the JSON representation of a String-String map containing the headers like this:

"headers": {
  "authorization": "bearer 1234"
}


Hope this helps,
Andrew



--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opentripplanner-dev/95093b6d-e047-4e57-bac2-f85c54b3eff3n%40googlegroups.com.

Tobias Walter

unread,
Apr 20, 2022, 6:46:09 AM4/20/22
to OpenTripPlanner Developers
Ok, thanks for the answers. I gonna try the solution by setting the headers.

Tobias Walter

unread,
Apr 20, 2022, 12:47:33 PM4/20/22
to OpenTripPlanner Developers
Alright, Andrew's solution worked for me. Here is a little example, of how it may work if you use a BearerToken.

router-config.json
"updaters": [
{
   "type": "vehicle-rental",
   "sourceType": "gbfs",
   "frequencySec": 60,
   "url": "https://gbfs-feed-url",
   "headers":{
     "Authorization": "yourToken"
   }
}
]

Leonard Ehrenfried

unread,
Apr 20, 2022, 1:28:08 PM4/20/22
to Opentripplanner Developers
If you'd like to contribute back to upstream we gladly accept documentation PRs.

Tobias Walter

unread,
May 10, 2022, 10:05:40 AM5/10/22
to OpenTripPlanner Developers
Reply all
Reply to author
Forward
0 new messages