@@ -61,25 +61,23 @@ static public OAuth20Service getApiFor20Provider(
6161 if (providerName .equalsIgnoreCase ("facebook" )) {
6262 return OAuthManagerProviders .facebookService (params , opts , callbackUrl );
6363 }
64-
64+
6565 if (providerName .equalsIgnoreCase ("google" )) {
6666 return OAuthManagerProviders .googleService (params , opts , callbackUrl );
6767 }
68-
68+
6969 if (providerName .equalsIgnoreCase ("github" )) {
7070 return OAuthManagerProviders .githubService (params , opts , callbackUrl );
7171 }
72-
72+
7373 if (providerName .equalsIgnoreCase ("slack" )) {
7474 return OAuthManagerProviders .slackService (params , opts , callbackUrl );
75- } else {
76- return null ;
7775 }
78-
76+
7977 if (params .containsKey ("access_token_url" ) && params .containsKey ("authorize_url" )) {
8078 return OAuthManagerProviders .configurableService (params , opts , callbackUrl );
8179 }
82-
80+
8381 return null ;
8482 }
8583
@@ -91,9 +89,9 @@ static public OAuthRequest getRequestForProvider(
9189 final HashMap <String ,Object > cfg ,
9290 @ Nullable final ReadableMap params
9391 ) {
94- final OAuth10aService service =
92+ final OAuth10aService service =
9593 OAuthManagerProviders .getApiFor10aProvider (providerName , cfg , null , null );
96-
94+
9795 String token = oa1token .getToken ();
9896 OAuthConfig config = service .getConfig ();
9997 OAuthRequest request = new OAuthRequest (httpVerb , url .toString (), config );
@@ -113,14 +111,14 @@ static public OAuthRequest getRequestForProvider(
113111 ) {
114112 final OAuth20Service service =
115113 OAuthManagerProviders .getApiFor20Provider (providerName , cfg , null , null );
116-
114+
117115 OAuthConfig config = service .getConfig ();
118116 OAuthRequest request = new OAuthRequest (httpVerb , url .toString (), config );
119117 String token = oa2token .getAccessToken ();
120118
121119 request = OAuthManagerProviders .addParametersToRequest (request , token , params );
122120
123- //
121+ //
124122 Log .d (TAG , "Making request for " + providerName + " to add token " + token );
125123 // Need a way to standardize this, but for now
126124 if (providerName .equalsIgnoreCase ("slack" )) {
@@ -159,12 +157,12 @@ static private OAuthRequest addParametersToRequest(
159157 }
160158
161159 private static OAuth10aService twitterService (
162- final HashMap cfg ,
160+ final HashMap cfg ,
163161 @ Nullable final ReadableMap opts ,
164162 final String callbackUrl ) {
165163 String consumerKey = (String ) cfg .get ("consumer_key" );
166164 String consumerSecret = (String ) cfg .get ("consumer_secret" );
167-
165+
168166 ServiceBuilder builder = new ServiceBuilder ()
169167 .apiKey (consumerKey )
170168 .apiSecret (consumerSecret )
@@ -180,20 +178,20 @@ private static OAuth10aService twitterService(
180178 if (callbackUrl != null ) {
181179 builder .callback (callbackUrl );
182180 }
183-
181+
184182 return builder .build (TwitterApi .instance ());
185183 }
186184
187185 private static OAuth20Service facebookService (
188- final HashMap cfg ,
186+ final HashMap cfg ,
189187 @ Nullable final ReadableMap opts ,
190188 final String callbackUrl ) {
191189 ServiceBuilder builder = OAuthManagerProviders ._oauth2ServiceBuilder (cfg , opts , callbackUrl );
192190 return builder .build (FacebookApi .instance ());
193191 }
194192
195193 private static OAuth20Service googleService (
196- final HashMap cfg ,
194+ final HashMap cfg ,
197195 @ Nullable final ReadableMap opts ,
198196 final String callbackUrl )
199197 {
@@ -202,7 +200,7 @@ private static OAuth20Service googleService(
202200 }
203201
204202 private static OAuth20Service githubService (
205- final HashMap cfg ,
203+ final HashMap cfg ,
206204 @ Nullable final ReadableMap opts ,
207205 final String callbackUrl )
208206 {
@@ -212,20 +210,27 @@ private static OAuth20Service githubService(
212210 }
213211
214212 private static OAuth20Service configurableService (
215- final HashMap cfg ,
213+ final HashMap cfg ,
216214 @ Nullable final ReadableMap opts ,
217215 final String callbackUrl
218216 ) {
219217 ServiceBuilder builder = OAuthManagerProviders ._oauth2ServiceBuilder (cfg , opts , callbackUrl );
218+ Log .d (TAG , "Creating ConfigurableApi" );
219+ //Log.d(TAG, " authorize_url: " + cfg.get("authorize_url"));
220+ //Log.d(TAG, " access_token_url: " + cfg.get("access_token_url"));
220221 ConfigurableApi api = ConfigurableApi .instance ()
221222 .setAccessTokenEndpoint ((String ) cfg .get ("access_token_url" ))
222223 .setAuthorizationBaseUrl ((String ) cfg .get ("authorize_url" ));
223-
224+ if (cfg .containsKey ("access_token_verb" )) {
225+ //Log.d(TAG, " access_token_verb: " + cfg.get("access_token_verb"));
226+ api .setAccessTokenVerb ((String ) cfg .get ("access_token_verb" ));
227+ }
228+
224229 return builder .build (api );
225230 }
226-
231+
227232 private static OAuth20Service slackService (
228- final HashMap cfg ,
233+ final HashMap cfg ,
229234 @ Nullable final ReadableMap opts ,
230235 final String callbackUrl
231236 ) {
@@ -262,13 +267,13 @@ private static ServiceBuilder _oauth2ServiceBuilder(
262267 String scopeStr = OAuthManagerProviders .getScopeString (scopes , "," );
263268 builder .scope (scopeStr );
264269 }
265-
270+
266271 if (opts != null && opts .hasKey ("scopes" )) {
267272 scopes = (String ) opts .getString ("scopes" );
268273 String scopeStr = OAuthManagerProviders .getScopeString (scopes , "," );
269274 builder .scope (scopeStr );
270275 }
271-
276+
272277 if (callbackUrl != null ) {
273278 builder .callback (callbackUrl );
274279 }
@@ -287,4 +292,4 @@ private static String getScopeString(
287292 Log .d (TAG , "array: " + array + " (" + array .size () + ") from " + scopes );
288293 return TextUtils .join (joinBy , array );
289294 }
290- }
295+ }
0 commit comments