Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fix incorrect account id parsing in authentication service
Browse files Browse the repository at this point in the history
closes #66

Signed-off-by: Oguzcan Kirmemis <[email protected]>
  • Loading branch information
oguzcankirmemis authored and wagmarcel committed Sep 22, 2023
1 parent 98402c9 commit 56872e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/authService/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Authenticate {
// check whether accounts contains only one element and role is device
var accounts = decoded_token.accounts;
var did = decoded_token.device_id ? decoded_token.device_id : decoded_token.sub;
var accountId = accounts ? accounts[0].id : null;
var accountId = accounts && accounts.length > 0 ? accounts[0].id : null;
let realm = getRealm(decoded_token);
// put realm/device into the list of accepted topics
await this.cache.setValue(realm + "/" + did, "acl", true);
Expand Down

0 comments on commit 56872e7

Please sign in to comment.