Skip to content

Commit 6405997

Browse files
authored
Merge pull request dropbox#162 from mako-taco/patch-1
Allows the webhost used for OAuth to be specified
2 parents 1b6cde9 + a6ed455 commit 6405997

File tree

1 file changed

+21
-5
lines changed
  • src/main/java/com/dropbox/core/android

1 file changed

+21
-5
lines changed

src/main/java/com/dropbox/core/android/Auth.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@
1010
* Helper class for integrating with {@link AuthActivity}
1111
*/
1212
public class Auth {
13-
13+
14+
15+
/**
16+
* @see Auth#startOAuth2Authentication(Context, String, String, String[], String, String)
17+
*/
1418
public static void startOAuth2Authentication(Context context, String appKey) {
1519
startOAuth2Authentication(context, appKey, null, null, null);
1620
}
1721

22+
/**
23+
* @see Auth#startOAuth2Authentication(Context, String, String, String[], String, String)
24+
*/
25+
public static void startOAuth2Authentication(Context context, String appKey, String desiredUid,
26+
String[] alreadyAuthedUids, String sessionId) {
27+
startOAuth2Authentication(context, appKey, desiredUid, alreadyAuthedUids, sessionId, "www.dropbox.com");
28+
}
29+
1830
/**
1931
* Starts the Dropbox authentication process by launching an external app
2032
* (either the Dropbox app if available or a web browser) where the user
@@ -41,12 +53,17 @@ public static void startOAuth2Authentication(Context context, String appKey) {
4153
* user accounts. (note that user may still authorize the accounts).
4254
* @param sessionId The SESSION_ID Extra on an OpenWith intent. null if dAuth
4355
* is being launched outside of OpenWith flow
56+
* @param webHost Server host used for oauth
4457
* @throws IllegalStateException if you have not correctly set up the AuthActivity in your
4558
* manifest, meaning that the Dropbox app will
4659
* not be able to redirect back to your app after auth.
4760
*/
48-
public static void startOAuth2Authentication(Context context, String appKey, String desiredUid,
49-
String[] alreadyAuthedUids, String sessionId) {
61+
public static void startOAuth2Authentication(Context context,
62+
String appKey,
63+
String desiredUid,
64+
String[] alreadyAuthedUids,
65+
String sessionId,
66+
String webHost) {
5067
if (!AuthActivity.checkAppBeforeAuth(context, appKey, true /*alertUser*/)) {
5168
return;
5269
}
@@ -57,9 +74,8 @@ public static void startOAuth2Authentication(Context context, String appKey, Str
5774

5875
// Start Dropbox auth activity.
5976
String apiType = "1";
60-
String webHost = "www.dropbox.com";
6177
Intent intent = AuthActivity.makeIntent(
62-
context, appKey, desiredUid, alreadyAuthedUids, sessionId, webHost, apiType
78+
context, appKey, desiredUid, alreadyAuthedUids, sessionId, webHost, apiType
6379
);
6480
if (!(context instanceof Activity)) {
6581
// If starting the intent outside of an Activity, must include

0 commit comments

Comments
 (0)