]> granicus.if.org Git - curl/commitdiff
auth: pick Bearer authentication whenever a token is available
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 20 Jul 2018 16:17:43 +0000 (18:17 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 24 Jul 2018 08:11:49 +0000 (10:11 +0200)
So far, the code tries to pick an authentication method only if
user/password credentials are available, which is not the case for
Bearer authentictation...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Closes #2754

lib/http.c

index 34565590f5a136da06165d834bb64159249721cd..bc1f858501bf35ce18cfa9c78b5e8bc85f794848 100644 (file)
@@ -520,7 +520,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
   if(data->state.authproblem)
     return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK;
 
-  if(conn->bits.user_passwd &&
+  if((conn->bits.user_passwd || conn->oauth_bearer) &&
      ((data->req.httpcode == 401) ||
       (conn->bits.authneg && data->req.httpcode < 300))) {
     pickhost = pickoneauth(&data->state.authhost, authmask);