Detecting User Cancellation
When a user cancels the browser session, the plugin throws a FlutterAppAuthUserCancelledException. This should be handled gracefully rather than treated as a critical error.
Handling Platform Errors
For other errors originating from the underlying platform SDKs, catch FlutterAppAuthPlatformException. You can access detailed error information, including RFC-compliant error codes, via the details property of type FlutterAppAuthPlatformErrorDetails.
try {
await appAuth.authorize(...);
} on FlutterAppAuthUserCancelledException catch (e) {
// Handle user cancellation gracefully
} on FlutterAppAuthPlatformException catch (e) {
final FlutterAppAuthPlatformErrorDetails details = e.details;
// Handle exceptions based on error codes from AppAuth
} catch (e) {
// Handle other errors
}