artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
683 stars 215 forks source link

Header to download a file #148

Closed dskanth closed 9 years ago

dskanth commented 9 years ago

I want to know, how to send the headers for downloading a file, as part of Oauth call.

I am initiating the oauth call as below: $download_endpoint = '/downloads/abc.zip'; $result = json_decode( $tw->request( $download_endpoint ), true );

But i need to send /zip or octet-stream as Accept Header, in order for the file to get downloaded. I am not sure how to specify the required Header in my oauth call. Can someone help me ?

dskanth commented 9 years ago

Well, i figured it out. I need to send the headers in my request as follows: $result = $tw->request( $download_endpoint, 'GET', '', array( "Accept" =>"application/octet-stream" ) );

Then i am able to see the file content in my browser.