Skip to content

Commit

Permalink
fix: refresh IdentityToken based on UserId instead of Token
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldoppea committed Aug 16, 2021
1 parent bd32e75 commit f79bc3c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/services/sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,17 @@ export class SyncService extends SyncServiceBase {
return;
}

const currentToken = await this.tokenService.getToken();
const currentUserId = this.tokenService.getUserId();

await this.localApiService.refreshIdentityToken();
const refreshedToken = await this.tokenService.getToken();
const refreshedUserId = this.tokenService.getUserId();

if (currentToken !== refreshedToken) {
const newUserId = this.tokenService.getUserId();
if (currentUserId !== refreshedUserId) {
const email = this.tokenService.getEmail();
const kdf = await this.localUserService.getKdf();
const kdfIterations = await this.localUserService.getKdfIterations();

await this.localUserService.setInformation(newUserId, email, kdf, kdfIterations);
await this.localUserService.setInformation(refreshedUserId, email, kdf, kdfIterations);
}
}

Expand Down

0 comments on commit f79bc3c

Please sign in to comment.