How to pass token instead of query string

Hi,

I have a m3u8 url and i have to pass a token on header without token stream will not play.
I have try this approch but still player is not playing

const requestCallback = (type, request) => {
console.log(‘type-----’, type);
console.log(‘request-------’, request);

// Modify the request
request.headers['Authorization'] = `Bearer ${currentToken}`;
request.method = 'GET';

// Return the processed request via a Promise
const processed = {
  body: request.body,
  headers: request.headers,
  method: request.method,
  url: request.url,
};
// console.log('🚀 ~ requestCallback ~ processed:', processed);
return Promise.resolve(processed);

};

const player = usePlayer({
licenseKey: ‘gfhgfhfh’,
networkConfig: {
preprocessHttpRequest: requestCallback,
},
});

@amit.kumar8 Could you please confirm which platform you are using? From the code, it looks like React Native. Additionally, did you inspect the network request to ensure it is as expected? What response is being returned from the server?

Hi Kishore,

Platform is iOS and yes it is a React Native code. I have checked the request everything is working fine.

Hi Amit,

If I understand correctly, the request/response is correct after the header manipulation. What error do you see when the playback fails? Are there any errors in the debug console?