authExpiredProvider function
Returns the provider id for an auth-expired formatted message, or null if there is no marker.
UIs can call this to render a re-authorize card instead of the raw redirect page. See formatProviderError and authExpiredMarkerPrefix.
Implementation
String? authExpiredProvider(String formattedError) {
final start = formattedError.indexOf(authExpiredMarkerPrefix);
if (start < 0) return null;
final close = formattedError.indexOf(
']]',
start + authExpiredMarkerPrefix.length,
);
if (close < 0) return null;
return formattedError.substring(
start + authExpiredMarkerPrefix.length,
close,
);
}