Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into akhil/1396/multi_…
Browse files Browse the repository at this point in the history
…user_level_authentication_poc_master
  • Loading branch information
akhil-deriv committed Jul 4, 2024
2 parents 267c861 + 9ce52dc commit 96fe2f7
Showing 1 changed file with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,23 @@ class DerivAuthService extends BaseAuthService {
responseAuthorizeEntity!.copyWith(
signupProvider: signupProvider,
refreshToken: refreshToken,
accountList: responseAuthorizeEntity.accountList
?.map(
(AccountListItem accountListItem) => accountListItem.copyWith(
token: accounts
.where(
(AccountModel element) =>
element.accountId == accountListItem.loginid,
)
.firstOrNull
?.token ??
token,
),
)
.toList(),
accountList: responseAuthorizeEntity.accountList?.map(
(AccountListItem accountListItem) {
final AccountModel? account = accounts.firstWhereOrNull(
(AccountModel element) =>
element.accountId == accountListItem.loginid,
);

if (account?.token == null) {
throw DerivAuthException(
message: 'Login is Expired',
type: AuthErrorType.expiredAccount,
);
}

return accountListItem.copyWith(token: account!.token);
},
).toList(),
);

await authRepository.onLogin(_enhancedAuthorizeEntity);
Expand Down

0 comments on commit 96fe2f7

Please sign in to comment.