PD
🧩 Plasmo Developersrandominis
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 });
})
2.1KMembers
View on DiscordWant results from more Discord servers?
More Postshow do you get a privacy policy when uploading to chrome web store?Most generators that I have searched for online require a link to your website to put in, but since await not definedhey! just trying out the basic extension framework using `create plasmo`. had the basics working, buLogging user errorsAnyone have any suggestions on any libraries or strategies that you use to log errors coming from usNo styling for options.tsxI have a basic options page written in TypeScript and styled via Tailwind CSS that displays perfectl