completePendingLoginIfNeeded method

Future<bool> completePendingLoginIfNeeded()

Attempts to complete a pending web login flow if auth parameters are present in the current URL.

This method performs a side-effect and may modify auth state and secure storage.

Call this before checking authentication status.

Implementation

Future<bool> completePendingLoginIfNeeded() async {
  final finishLoginUri = _isCurrentUrlContainWebAuthParams();
  if (finishLoginUri != null) {
    final storedState = await _kindeSecureStorage.getAuthRequestState();
    if (storedState != null) {
      return _finishWebLogin(finishLoginUri);
    }
  }
  return false;
}