isSecureAuthUrl function

bool isSecureAuthUrl(
  1. Uri uri
)

Whether uri is safe to use for an OAuth/OIDC network call.

https is always considered secure. Plaintext http is considered secure only when the host is a loopback address (local development). Every other scheme/host combination is treated as insecure.

Implementation

bool isSecureAuthUrl(Uri uri) {
  if (uri.scheme == 'https') return true;
  if (uri.scheme == 'http' && _loopbackHosts.contains(uri.host)) return true;
  return false;
}