XamarinMediaManager icon indicating copy to clipboard operation
XamarinMediaManager copied to clipboard

Request headers refresh

Open izebaKK opened this issue 7 years ago • 3 comments

I have to play video in my Xamarin.Forms application from web service that needs authentication, so I have to set authentication request headers on request. And everything is ok when I set headers for the first time (in OnStart method in App.xaml.cs). But, when I have to refresh these headers (after application resuming for example- in OnResume method in App.xaml.cs) after access token expiration, I'm getting failure with 401 code. I'm setting headers like this:

if (CrossMediaManager.Current.RequestHeaders.ContainsKey("Authorization")) CrossMediaManager.Current.RequestHeaders.Remove("Authorization"); CrossMediaManager.Current.RequestHeaders.Add("Authorization", "Bearer " + AccessToken);

Am I doing something wrong or?

izebaKK avatar Jul 19 '19 08:07 izebaKK

Fix in https://github.com/martijn00/XamarinMediaManager/commit/34e61f95f87e4bdd229dc72ea3e0f99a5c630870

Next time fill out the issue template or your issue will get closed.

martijn00 avatar Jul 22 '19 13:07 martijn00

Also you need to set a complete new object on it, otherwise the change will not be triggered.

martijn00 avatar Jul 22 '19 13:07 martijn00

Hi again! Sorry for not answering, I was working on another project and had no time for testing this. Can you just please give me an example because I'm not sure what do you mean by "set a complete new object on it". Sorry for bothering again...

Thanks!

izebaKK avatar Dec 18 '19 15:12 izebaKK