Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/msal_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ class MsalUninitializedException extends MsalException {
: super(
"Client not initialized. Client must be initialized before attempting to use");
}

class MsalForgotPasswordException extends MsalException {
MsalForgotPasswordException() : super("User forgot password");
}
14 changes: 13 additions & 1 deletion lib/src/public_client_application.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:async';

import 'package:flutter/services.dart';

import 'msal_exception.dart';

/// Represents a PublicClientApplication used to authenticate using the implicit flow
Expand Down Expand Up @@ -88,7 +90,17 @@ class PublicClientApplication {
return MsalInitializationException();
case "AUTH_ERROR":
default:
return MsalException("Authentication error");

/// PlatformException(AUTH_ERROR, Authentication error, The operation couldn’t be completed. (MSALErrorDomain error -50000.))
/// PlatformException(AUTH_ERROR, Authentication failed, access_denied;AADB2C90118: The user has forgotten their password.
var detailsInLowerCase = e.details.toString().toLowerCase();
if (e.details != null &&
(detailsInLowerCase.contains('msalerrordomain error -50000') ||
detailsInLowerCase.contains('aadb2c90118'))) {
return MsalForgotPasswordException();
} else {
return MsalException("Authentication error");
}
}
}

Expand Down