react-native-event-source
react-native-event-source copied to clipboard
How do I refresh authorization token when it expires
I am setting the authorization header as below. The connection is opened, however, after a while, it starts to fail when the authorization token expires. How do I set the new token(refreshed)?
import RNEventSource from 'react-native-event-source';
function* sseSaga() {
const authorization = yield select(getAuthorization);
logger.info('sseSaga ');
const eventSource = new RNEventSource(
environment.server_url + /events?loginProvider=${'google'},
{
headers: {
authorization: Bearer ${authorization},
},
},
);
}