public bool PerformCheckAndRefresh(out EPerformCheckAndRefreshSuccessStatus _SuccessStatus, out string _NewAccessTokenWithTokenType, out string _UserID, out string _EmailAddressWithoutPostfix) { _SuccessStatus = EPerformCheckAndRefreshSuccessStatus.None; _UserID = null; _NewAccessTokenWithTokenType = AccessToken_TokenTypeSpacePrepended; if (!ValidateAccessTokenSyntax(out _EmailAddressWithoutPostfix, out string _)) { return(false); } var bCheckResult = CheckTokenExpiry(out _UserID, out bool _bExpired, out string _RefreshToken); if (!bCheckResult || _bExpired) { if (_UserID == null || _RefreshToken == null) { return(false); } TryDeletingAuthMethodAndMemoryEntry(_UserID, _EmailAddressWithoutPostfix); if (!TryRefreshingAccessToken(out Controller_SSOAccessToken AccessTokenManager, out string NewRefreshToken, out int ExpiresInSeconds, _RefreshToken)) { return(false); } if (!AccessTokenManager.RegisterAuthMethodAndMemoryEntryAfterRefresh(_UserID, _EmailAddressWithoutPostfix, ExpiresInSeconds, NewRefreshToken)) { AccessTokenManager.TryDeletingAuthMethodAndMemoryEntry(_UserID, _EmailAddressWithoutPostfix); //Again, in case some are managed to be registered. return(false); } _NewAccessTokenWithTokenType = AccessTokenManager.AccessToken_TokenTypeSpacePrepended; _SuccessStatus = EPerformCheckAndRefreshSuccessStatus.Refreshed; } else { _SuccessStatus = EPerformCheckAndRefreshSuccessStatus.AlreadyValid; } return(true); }