twilio java connection with proxy authentication

我们两清 提交于 2019-12-02 05:45:23

Resolved... just needed to add another set of credentials that were scoped to api.twilio.com after the proxy credentials:

    //Set up Proxy user credentials
    CredentialsProvider credsProvider = new BasicCredentialsProvider();
    credsProvider.setCredentials(
            new AuthScope(PROXY_ADDRESS, PROXY_PORT), 
            new UsernamePasswordCredentials(PROXY_USER, PROXY_PASSWORD));

    //Set up Twilio user credentials
    credsProvider.setCredentials(
            new AuthScope("api.twilio.com", 443), 
            new UsernamePasswordCredentials(ACCOUNT_SID, AUTH_TOKEN));

I'll leave this here for posterity because there has been several questions about this but no accepted answers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!