Proxy authentication and API calls afterward

Hello, guys. I'm starting to give up. I'm developing proxy extension and proxying works okay. But if I make calls from inside of popup context of extension it always brig me 407 proxy authentication error. If I dont do any calls and browse the internet with those proxies, everything is fine. But it is crucial for me to fetch latest users' IP address. The listener is added after connecting to proxies synchronously and everything happens in Popup context, not background. Im using redux with redux-persist from Plasmo. This is the proxying part: const setChromeProxy = ({ domain, port, protocol }: Omit<ISetProxy, 'proxyType' | 'isWhitelistedIp'>) => { const value = { mode, rules: { singleProxy: { scheme: protocol, host: domain, port }, bypassList: BYPASS_LIST } }; BROWSER.proxy.settings.set({ value, scope }, () => {}); }; and this is the listener part: const authListener = () => ({ authCredentials: { username: getFormattedUsername(store.getState()), password: getFormattedPassword(store.getState()) } }); const addAuthUserListener = () => { removeAuthListener(); chrome.webRequest.onAuthRequired.addListener(authListener, urlsObject, [ 'blocking' ]); }; this is the api call: callApi({ url: secret }) .then(({ data: { country, proxy } }) => { dispatch(setLocation(country.name)); dispatch(setIP(proxy.ip)); dispatch(setEnabled(true)); changeIcon({ enabled: true }); })
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server