Pyrebase: Streaming from the REST API with a Service Account

296 views
Skip to first unread message

James

unread,
Aug 20, 2016, 10:34:04 AM8/20/16
to Firebase Google Group
Hi there,

I am attempting to add streaming capabilities to Pyrebase for service accounts and have hit a bit of a brick wall.

With the standard calls to the REST API I just add an 'Authorization' header with the Service Account's access token, for example:

'Authorization': 'Bearer ya29.CjBFAzpjUba2OcLugE1K4aUPu4OqhJK9094P2WnIpgDpgZCONOBtga9B-eT7hrL8M_s'

This works just fine. However, this approach does not seem to be working when it comes to streaming, I get a standard:

401 Client Error: Unauthorized for url

Anyone have any hints? 

Thanks for your help!



Gil Gilbert

unread,
Aug 22, 2016, 1:57:56 PM8/22/16
to Firebase Google Group
The streaming API involves a redirect (HTTP 300-something with a Location header). Are you including the Authorization header on the request following the redirect?

Cheers,
-Gil

James

unread,
Aug 22, 2016, 7:30:48 PM8/22/16
to Firebase Google Group
Thanks for the info Gil,

I'm using sseclient which relies on requests, which I just found out strips authorization headers on redirect. Will have to figure out a work around. 

Thanks again,
James
Reply all
Reply to author
Forward
0 new messages