I am trying to make proxy settings via a fake vpn in my react native android application. I am giving proxy settings into builder thanks to VpnService with android.net.ProxyInfo package. But the proxy I am using has an auth requirement. I guess ProxyInfo doesn't take a credentials directly. How can I do this?
When I enter any site with the current settings, it gives me the following message.
not auth or invalid auth credentials. make sure to update your proxy address, proxy username and password
I tried with the other method below but I can't say it worked. when I tried to open the site my browser asked me for username and password with a popup, but the popup is so unstable that I can't even type it.
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
Log.d("VPNService", "VPN Auth Settings...");
return new PasswordAuthentication("username", "password".toCharArray());
}
});
I should add that this proxy will not work specifically in some places. So as long as the vpn works, it will be active, a global method is needed, not just an application-by-application effect.
What I need is how can I give auth info when using proxy with vpn?
Thanks in advance for the explanatory answers
I was able to do this using the tun2socks package. you can add the source code as a library to your code in .aar file format. then impelement it in app/buildgradle. you can now use the library in a vpn service. with key and engine values http / https / socks5 will be available. besides that it passes through proxy checkers without any problem. proxy info is not very good at this.