Overriding Box Auth URL in JDK
We are writing some Box client components using the Box JDK. Because of the security at the organization we need to use proxy URLs between the components we are building which will be sitting inside the organization. We have one piece we are trying to figure out..can we use a proxy to obtain the Box OAuth2 token. If you look at a sample code snippet below you will see what I am getting at.
// URL direct to Box to be replaced
//private static final String TOKEN_URL_STRING = "https://api.box.com/oauth2/token";
// sample replacement proxy URL
private static final String TOKEN_URL_STRING = "https://bnc.proxy.url/oauth2/token";
...
...
// get connection using proxied URL
BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig, accessTokenCache);
So will the above even work? Or is there a workaround/alternate suggestion or approach?
-
Hi The_Kid,
Although this might at last be possible (if your proxy then redirects to the actual server address), I don't think you need to do this.
Why not just specify the proxy? It is a common use case to have proxies. The api directly supports it:
http://opensource.box.com/box-java-sdk/javadoc/com/box/sdk/BoxAPIConnection.html
Let me know if this does the job for you.
-
Hey there,
Thanks for your quick response. So this is specific to the authorization URL. We can use proxies for the other Box URLs but not for the authorization URL. When I took a peek at the link you gave me I could see a getAuthorizationURL method but not a corresponding setter method. I'm gathering from this thread is there is nothing we can do about this in the JDK..am I correct?
サインインしてコメントを残してください。
コメント
2件のコメント