Skip to content

Commit 7f51d82

Browse files
committed
feat(accounts): warn when missing scopes
Signed-off-by: Adam Setch <[email protected]>
1 parent 3863d0c commit 7f51d82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/renderer/utils/auth/utils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,13 @@ export async function refreshAccount(account: Account): Promise<Account> {
170170
res.headers['x-github-enterprise-version'],
171171
);
172172

173-
account.hasRequiredScopes = res.headers['x-oauth-scopes']
174-
.split(',')
175-
.includes(Constants.AUTH_SCOPE);
173+
const accountScopes = res.headers['x-oauth-scopes']
174+
?.split(',')
175+
.map((scope) => scope.trim());
176+
177+
account.hasRequiredScopes = Constants.AUTH_SCOPE.every((scope) =>
178+
accountScopes.includes(scope),
179+
);
176180
} catch (err) {
177181
log.error(
178182
'[refreshAccount]: failed to refresh account for user',

0 commit comments

Comments
 (0)