@@ -44,6 +44,7 @@ public class BoxAPIConnection {
4444 private String userAgent ;
4545 private String accessToken ;
4646 private String refreshToken ;
47+ private String tokenURL ;
4748 private String baseURL ;
4849 private String baseUploadURL ;
4950 private boolean autoRefresh ;
@@ -71,6 +72,7 @@ public BoxAPIConnection(String clientID, String clientSecret, String accessToken
7172 this .clientSecret = clientSecret ;
7273 this .accessToken = accessToken ;
7374 this .refreshToken = refreshToken ;
75+ this .tokenURL = TOKEN_URL_STRING ;
7476 this .baseURL = DEFAULT_BASE_URL ;
7577 this .baseUploadURL = DEFAULT_BASE_UPLOAD_URL ;
7678 this .autoRefresh = true ;
@@ -108,7 +110,7 @@ public BoxAPIConnection(String clientID, String clientSecret) {
108110 public void authenticate (String authCode ) {
109111 URL url = null ;
110112 try {
111- url = new URL (TOKEN_URL_STRING );
113+ url = new URL (this . tokenURL );
112114 } catch (MalformedURLException e ) {
113115 assert false : "An invalid token URL indicates a bug in the SDK." ;
114116 throw new RuntimeException ("An invalid token URL indicates a bug in the SDK." , e );
@@ -147,6 +149,24 @@ public long getExpires() {
147149 return this .expires ;
148150 }
149151
152+ /**
153+ * Gets the token URL that's used to request access tokens. The default value is
154+ * "https://www.box.com/api/oauth2/token".
155+ * @return the token URL.
156+ */
157+ public String getTokenURL () {
158+ return this .tokenURL ;
159+ }
160+
161+ /**
162+ * Sets the token URL that's used to request access tokens. For example, the default token URL is
163+ * "https://www.box.com/api/oauth2/token".
164+ * @param tokenURL the token URL.
165+ */
166+ public void setTokenURL (String tokenURL ) {
167+ this .tokenURL = tokenURL ;
168+ }
169+
150170 /**
151171 * Gets the base URL that's used when sending requests to the Box API. The default value is
152172 * "https://api.box.com/2.0/".
@@ -317,7 +337,7 @@ public void refresh() {
317337
318338 URL url = null ;
319339 try {
320- url = new URL (TOKEN_URL_STRING );
340+ url = new URL (this . tokenURL );
321341 } catch (MalformedURLException e ) {
322342 this .refreshLock .writeLock ().unlock ();
323343 assert false : "An invalid refresh URL indicates a bug in the SDK." ;
0 commit comments