Skip to content

Commit

Permalink
also follow redirects for follow-up requests
Browse files Browse the repository at this point in the history
  • Loading branch information
dreautall committed Dec 22, 2024
1 parent e56fddb commit 82de3df
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class APIRequestInterceptor implements Interceptor {
log.finest(() => "API query to ${chain.request.url}");
final Request request =
applyHeaders(chain.request, headerFunc(), override: true);
request.followRedirects = false;
request.maxRedirects = 0;
request.followRedirects = true;
request.maxRedirects = 5;
return chain.proceed(request);
}
}
Expand Down Expand Up @@ -180,6 +180,7 @@ class AuthUser {
request.headers[HttpHeaders.authorizationHeader] = "Bearer $apiKey";
// See #497, redirect is a bad way to check for (un)successful login.
request.followRedirects = true;
request.maxRedirects = 5;
final http.StreamedResponse response = await client.send(request);

// If we get an html page, it's most likely the login page, and auth failed
Expand Down

0 comments on commit 82de3df

Please sign in to comment.